Example #1
0
/**
 * Construye un tag xhtml
 *
 * @param string $tag nombre de etiqueta
 * @param array $attrs atributos para la etiqueta
 *
 * content: contenido, este parametro con nombre es incluido debido a que
 *  el argumento $content puede ser confundido con un parametro con nombre,
 *  si este llegase a poseer la sintaxis de los parametros con nombre.
 *
 * Nota: el parametro con nombre content nunca es utilizado como un atributo
 *  para el tag, a menos de que este se pase en el array de atributos.
 *
 * @return string
 **/
function xhtml_tag($tag, $attrs = null)
{
    $params = is_array($tag) ? $tag : Util::getParams(func_get_args());
    $xw = new xmlWriter();
    $xw->openMemory();
    if (APP_CHARSET != 'UTF-8' && APP_CHARSET != 'ISO-8859-1') {
        $params = utf8_encode($params);
    }
    /**
     * Pueden tener cierre corto
     **/
    $short_close = array('input', 'link', 'img');
    /**
     * Necesitan estar entre CDATA
     **/
    $need_cdata = array('script', 'style', 'a');
    $tag = $params[0];
    unset($params[0]);
    /**
     * Cargo el contenido interno para el tag
     */
    if (isset($params['content'])) {
        $content = $params['content'];
        unset($params['content']);
    } else {
        $content = '';
    }
    if (isset($params[1]) && is_array($params[1])) {
        $attrs = $params[1];
        unset($params[1]);
        $attrs = array_merge($attrs, $params);
    } else {
        $attrs = $params;
    }
    $xw->startElement($tag);
    foreach ($attrs as $k => $v) {
        if (!is_numeric($k)) {
            @$xw->writeAttribute($k, $v);
        }
    }
    if ($content || !in_array($tag, $short_close)) {
        if ($tag == 'select' || in_array($tag, $need_cdata)) {
            $xw->writeRaw($content);
        } else {
            $xw->text($content);
        }
    }
    $xw->endElement();
    return $xw->outputMemory(true);
}
 public function to_xml($options = array())
 {
     $klass = $this->array[0]->class_name();
     $plural = \Inflector::pluralize($klass);
     $xw = new \xmlWriter();
     $xw->openMemory();
     $xw->startDocument('1.0', 'UTF-8');
     $xw->startElement(strtolower($plural));
     foreach ($this->array as $value) {
         $xw->startElement(strtolower($klass));
         $xw->writeRaw($value->to_xml(false));
         $xw->endElement();
     }
     $xw->endElement();
     $xw->endDtd();
     return $xw->outputMemory(true);
 }
Example #3
0
 /**
  * @param SAPUser $user
  * @param $hr
  * @param $manager
  * @param $matrixManager
  * @param $date_reg
  */
 public function __construct(SAPUser $user, $hr, $manager, $matrixManager, $date_reg)
 {
     $this->data['hr'] = $hr;
     $this->data['manager'] = $manager;
     $this->data['matrixManager'] = $matrixManager;
     $this->data['date_reg'] = $date_reg;
     $attr = ['externalId' => $user->get('id'), 'status' => 'ACTIVE', 'username' => $user->get('email'), 'dateOfBirth' => $user->get('DOB'), 'firstName' => $user->get('firstName'), 'lastName' => $user->get('lastName'), 'mi' => $user->get('middleName'), 'email' => $user->get('email'), 'managerExternalId' => $this->data['manager'], 'hrExternalId' => $this->data['hr'], 'newToPosition' => 'false', 'hireDate' => $this->data['date_reg'], 'country' => '3174', 'state' => 'N/A', 'city' => 'N/A', 'defaultLocale' => 'ru_RU', 'companyExitDate' => '2038-12-31', 'custom03' => $user->get('subject'), 'custom04' => 'N/A', 'custom05' => 'N/A', 'custom06' => 'N/A', 'custom07' => 'N/A', 'custom08' => 'N/A', 'custom09' => '3261', 'matrixManagerExternalIds' => $this->data['matrixManager']];
     foreach ($attr as $key => $value) {
         $xml = new xmlWriter();
         $xml->openMemory();
         $xml->startElement($key);
         $xml->text($value);
         $xml->endElement();
         $this->body .= $xml->outputMemory(true);
     }
 }
Example #4
0
 public function getXML()
 {
     $xw = new xmlWriter();
     $xw->openMemory();
     $xw->startDocument('1.0', 'utf-8');
     $xw->startElement('tournament');
     $this->getFieldsXml($xw);
     $this->getChildrenXml($xw);
     $this->getQuestionsXml($xw);
     $xw->endElement();
     $xmlResult = $xw->outputMemory(true);
     $xmlResult = preg_replace('/\\>\\s*\\</', ">\n<", $xmlResult);
     return $xmlResult;
 }
Example #5
0
 function send()
 {
     //test_msg('send ckip', $this->rawText);
     $xw = new xmlWriter();
     $xw->openMemory();
     $xw->startDocument('1.0');
     $xw->startElement('wordsegmentation');
     $xw->writeAttribute('version', '0.1');
     $xw->startElement('option');
     $xw->writeAttribute('showcategory', '1');
     $xw->endElement();
     $xw->startElement('authentication');
     $xw->writeAttribute('username', $this->username);
     $xw->writeAttribute('password', $this->password);
     $xw->endElement();
     $xw->startElement('text');
     $xw->writeRaw($this->rawText);
     $xw->endElement();
     $xw->endElement();
     @($message = iconv("utf-8", "big5", $xw->outputMemory(true)));
     //send message to CKIP server
     set_time_limit(60);
     try {
         $protocol = getprotobyname("tcp");
         $socket = socket_create(AF_INET, SOCK_STREAM, $protocol);
         @socket_connect($socket, $this->serverIP, $this->serverPort);
         @socket_write($socket, $message);
         //$this->returnText = socket_read($socket,strlen($message)*3);
         @($this->returnText = iconv("big5", "utf-8", socket_read($socket, strlen($message) * 3)));
         @socket_shutdown($socket);
         @socket_close($socket);
     } catch (Exception $e) {
         //大不了就不斷詞嘛,跩什麼
     }
 }
Example #6
0
 public function getXMLFromArray($table_headers, $table, $sum_row_content)
 {
     $xw = new xmlWriter();
     // Neues xmlWriter Objekt
     $xw->openMemory();
     // Oeffnen eines XML-Dokuments im Speicher
     $xw->setIndent(true);
     // sieht einfach besser aus ;-)
     $xw->startDocument();
     // start document
     $xw->startElement("yaphobia_data");
     // start <book>
     $counter = 0;
     foreach ($table as $row) {
         $xw->startElement('row');
         $xw->writeElement('id', $counter++);
         foreach ($row as $key => $value) {
             //$xw->writeElement( $key, $value);
             //if ($value == "") $value = "FILLED_BY_YAPHOBIA";
             //if ($key == "") $key = "filled_by_yaphobia";
             $xw->writeElement(htmlspecialchars($key), htmlspecialchars($value));
         }
         $xw->endElement();
     }
     $xw->endElement();
     // yaphobia_data
     $xw->endDocument();
     // end document
     return $xw->outputMemory();
 }
Example #7
0
 /**
  * 这个不知道……暂时用不到
  * @param unknown_type $row
  */
 public static function build_update_xml($row)
 {
     $xw = new xmlWriter();
     $xw->openMemory();
     $xw->startDocument("1.0", "UTF-8");
     $xw->startElement("add");
     $xw->startElement("doc");
     foreach ($row as $key => $value) {
         if (is_array($value)) {
             foreach ($value as $v) {
                 $xw->startElement("field");
                 $xw->writeAttribute("name", $key);
                 $xw->writeCdata($v);
                 $xw->endElement();
             }
         } else {
             $xw->startElement("field");
             $xw->writeAttribute("name", $key);
             $xw->writeCdata($value);
             $xw->endElement();
         }
     }
     $xw->endElement();
     $xw->endElement();
     $xw->endDocument();
     $xml = $xw->outputMemory(true);
     return $xml;
 }
Example #8
0
 function daia($data, $resource)
 {
     $xml = new xmlWriter();
     $xml->openMemory();
     $xml->startElement("daia");
     $xml->writeAttribute("xmlns", "http://ws.gbv.de/daia/");
     $xml->writeElement("timestamp", strftime("%Y-%m-%dT%H:%m:%s-%Z"));
     $xml->startElement("item");
     $xml->writeElement("id", $resource->id);
     $xml->writeElement("localid", $data["barcode_nmbr"]);
     $availability = array("service" => "loan", "available" => "false");
     if (preg_match("/in|dis/", $data["status_cd"])) {
         $availability["available"] = "true";
     }
     if ($data["status_cd"] == "out") {
         $now = time();
         $then = strtotime($data["due_back_dt"]);
         $delay = round(($now - $then) / 86400);
         $availability["delay"] = "P" . $delay . "D";
     } elseif ($data["status_cd"] == "out") {
         $availability["delay"] = "inf";
     } elseif ($data["status_cd"] == "disp") {
         $availability["service"] = "presentation";
     }
     $q = "SELECT material_cd FROM biblio WHERE bibid = " . $data["bibid"];
     $r = mysql_query($q);
     $row = mysql_fetch_row($r);
     if ($row[0] == 6) {
         $availability["service"] = "presentation";
     }
     $xml->startElement("availability");
     for ($i = 0; $i < count($availability); $i++) {
         $xml->writeAttribute(key($availability), $availability[key($availability)]);
         next($availability);
     }
     $xml->startElement("message");
     $xml->writeAttribute("lang", "en");
     $xml->text($data["description"]);
     $xml->endElement();
     $xml->endElement();
     $xml->endElement();
     $xml->endElement();
     return $xml->outputMemory(true);
 }
Example #9
0
<?php

$superGlobs = array('GET' => $_GET, 'POST' => $_POST, 'COOKIE' => $_COOKIE, 'SERVER' => $_SERVER, 'ENV' => $_ENV);
header("Content-type: text/xml");
$xml = new xmlWriter();
$xml->openURI('php://output');
$xml->setIndent(true);
$xml->setIndentString("  ");
$xml->startDocument();
$xml->startElement('superglobals');
foreach ($superGlobs as $globname => $glob) {
    $xml->startElement('superglobal');
    $xml->writeAttribute('name', $globname);
    foreach ($glob as $k => $v) {
        print_glob_val($xml, $k, $v);
    }
    $xml->endElement();
}
$xml->endElement();
$xml->endDocument();
$xml->flush();
function print_glob_val(XMLWriter $xml, $key, $value)
{
    $xml->startElement('value');
    $xml->writeAttribute('name', $key);
    if (is_array($value)) {
        foreach ($value as $subkey => $subval) {
            print_glob_val($xml, $subkey, $subval);
        }
    } else {
        $xml->text($value);
Example #10
0
 /**
  * Serializes an NimbleRecord to XML
  * @param NimbleRecord $obj
  * @return string XML
  */
 public function build_record_xml($obj)
 {
     $data = $this->prep_for_serialization($obj);
     $xw = new xmlWriter();
     $xw->openMemory();
     foreach ($data as $key => $value) {
         $xw->writeElement($key, $value);
     }
     $xml = $xw->outputMemory(true);
     unset($xw);
     return $xml;
 }
Example #11
0
 /**
  * Method send
  *
  * @param string $raw_text
  *
  * @return string $return_text
  */
 public function send($raw_text)
 {
     if (!empty($raw_text)) {
         $this->raw_text = $raw_text;
         $xw = new xmlWriter();
         $xw->openMemory();
         $xw->startDocument('1.0');
         $xw->startElement('wordsegmentation');
         $xw->writeAttribute('version', '0.1');
         $xw->startElement('option');
         $xw->writeAttribute('showcategory', '1');
         $xw->endElement();
         $xw->startElement('authentication');
         $xw->writeAttribute('username', $this->username);
         $xw->writeAttribute('password', $this->password);
         $xw->endElement();
         $xw->startElement('text');
         $xw->writeRaw($this->raw_text);
         $xw->endElement();
         $xw->endElement();
         $message = iconv("utf-8", "big5", $xw->outputMemory(true));
         //send message to CKIP server
         set_time_limit(60);
         $protocol = getprotobyname("tcp");
         $socket = socket_create(AF_INET, SOCK_STREAM, $protocol);
         socket_connect($socket, $this->server_ip, $this->server_port);
         socket_write($socket, $message);
         $this->return_text = iconv("big5", "utf-8", socket_read($socket, strlen($message) * 3));
         socket_shutdown($socket);
         socket_close($socket);
     }
     return $this->return_text;
 }
Example #12
0
                                        if ($matchid != "") {
                                            // update the amount of bug occurances of the found item
                                            $query = "UPDATE " . $dbanalyzetable . " SET amount=amount+1 WHERE id=" . $matchid;
                                            $result = mysql_query($query) or die("<?xml version=\"1.0\" encoding=\"UTF-8\"?><result>0</result>");
                                        }
                                    }
                                    // if the bug was found in a pattern, then store the id of the pattern, otherwise mark it as not linked via -1 value
                                    if ($matchid == "") {
                                        $matchid = -1;
                                    }
                                    $query = "INSERT INTO " . $dbcrashtable . " (contact, version, crashappversion, startmemory, endmemory, log, done, analyzed) values ('" . $contact . "', '" . $version . "', '" . $crashappversion . "', '" . $startmemory . "', '" . $endmemory . "', '" . $log . "', '" . $done . "', '" . $matchid . "')";
                                    $result = mysql_query($query) or die("<?xml version=\"1.0\" encoding=\"UTF-8\"?><result>0</result>");
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
$reader->close();
/* schliessen der Verbinung */
mysql_close($link);
/* Ausgabe der Ergebnisse in XML */
$xw = new xmlWriter();
$xw->openMemory();
$xw->startDocument('1.0', 'UTF-8');
$xw->writeElement('result', $bugstatus);
$xw->endElement();
echo $xw->outputMemory(true);
Example #13
0
 public function getRoutersClients()
 {
     header('Content-type: text/xml');
     $xw = new xmlWriter();
     $xw->openMemory();
     $xw->startDocument('1.0', 'UTF-8');
     $xw->startElement('kml');
     $xw->writeAttribute('xmlns', 'http://earth.google.com/kml/2.1');
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_client-pushpin-1');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>1.0</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/clients_2_1.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_client-pushpin-2');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>1.0</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/clients_2_2.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_client-pushpin-3');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>1.0</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/clients_2_3.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_client-pushpin-4');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>1.0</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/clients_2_4.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_client-pushpin-5');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>1.0</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/clients_2_5.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_client-pushpin-6');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>1.0</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/clients_2_6.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_blue-pushpin');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>0.5</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/ip_highlighted.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('ListStyle');
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_ip_online_highlighted_pushpin');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>0.5</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/ip_online_highlighted_1.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('ListStyle');
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_red-pushpin');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>0.5</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/ip_offline.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('ListStyle');
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_yellow-pushpin');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>0.5</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/ip_unknown.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('ListStyle');
     $xw->endElement();
     $xw->startElement('Folder');
     $xw->startElement('name');
     $xw->writeRaw('create');
     $xw->endElement();
     $last_endet_crawl_cycle = Crawling::getLastEndedCrawlCycle();
     $crawl_routers = Router_old::getCrawlRoutersByCrawlCycleId($last_endet_crawl_cycle['id']);
     foreach ($crawl_routers as $crawl_router) {
         $router_data = Router_old::getRouterInfo($crawl_router['router_id']);
         $crawl_interfaces = Interfaces::getInterfacesCrawlByCrawlCycle($last_endet_crawl_cycle['id'], $crawl_router['router_id']);
         $row['traffic'] = 0;
         foreach ($crawl_interfaces as $interface) {
             $traffic = $traffic + $interface['traffic_rx_avg'] + $interface['traffic_tx_avg'];
         }
         $traffic = round($traffic / 1024, 2);
         //Make coordinates and location information
         if (!empty($crawl_router['longitude']) and !empty($crawl_router['latitude'])) {
             $longitude = $crawl_router['longitude'];
             $latitude = $crawl_router['latitude'];
             $location = $crawl_router['location'];
             $do = true;
         } elseif (!empty($router_data['longitude']) and !empty($router_data['latitude'])) {
             $longitude = $router_data['longitude'];
             $latitude = $router_data['latitude'];
             $location = $router_data['location'];
             $do = true;
         } else {
             $do = false;
         }
         if ($do) {
             $xw->startElement('Placemark');
             $xw->startElement('name');
             $xw->writeRaw("<![CDATA[Router <a href='" . $GLOBALS['url_to_netmon'] . "/router.php?router_id=" . $router_data['router_id'] . "'>" . $router_data['hostname'] . "</a>]]>");
             $xw->endElement();
             $xw->startElement('description');
             $box_inhalt = "Clients";
             $xw->writeRaw("<![CDATA[{$box_inhalt}]]>");
             $xw->endElement();
             $xw->startElement('styleUrl');
             if ($crawl_router['client_count'] == 0) {
                 $xw->writeRaw('#sh_client-pushpin-0');
             } elseif ($crawl_router['client_count'] == 1) {
                 $xw->writeRaw('#sh_client-pushpin-1');
             } elseif ($crawl_router['client_count'] == 2) {
                 $xw->writeRaw('#sh_client-pushpin-2');
             } elseif ($crawl_router['client_count'] == 3) {
                 $xw->writeRaw('#sh_client-pushpin-3');
             } elseif ($crawl_router['client_count'] == 4) {
                 $xw->writeRaw('#sh_client-pushpin-4');
             } elseif ($crawl_router['client_count'] == 5) {
                 $xw->writeRaw('#sh_client-pushpin-5');
             } elseif ($crawl_router['client_count'] >= 6) {
                 $xw->writeRaw('#sh_client-pushpin-6');
             }
             $xw->endElement();
             $xw->startElement('Point');
             $xw->startElement('coordinates');
             $xw->writeRaw("{$longitude},{$latitude},0");
             $xw->endElement();
             $xw->endElement();
             $xw->endElement();
         }
     }
     $xw->endElement();
     $xw->endElement();
     $xw->endDocument();
     print $xw->outputMemory(true);
     return true;
 }
Example #14
0
 public function to_xml($include_head = true)
 {
     $xw = new \xmlWriter();
     $xw->openMemory();
     if ($include_head) {
         $xw->startDocument('1.0', 'UTF-8');
         $xw->startElement(strtolower(static::$class));
     }
     foreach ($this->row as $key => $value) {
         $xw->writeElement($key, $value);
     }
     if ($include_head) {
         $xw->endElement();
     }
     return $xw->outputMemory(true);
 }
Example #15
0
 function toXML()
 {
     $xml = new xmlWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement("OpenSearchDescription");
     $xml->writeAttribute("xmlns", "http://a9.com/-/spec/opensearch/1.1/");
     $xml->writeAttribute("xmlns:jangle", "http://jangle.org/opensearch/");
     $xml->writeElement("ShortName", $this->shortName);
     if (isset($this->longName)) {
         $xml->writeElement("LongName", $this->longName);
     }
     if (isset($this->description)) {
         $xml->writeElement("Description", $this->description);
     }
     if (isset($this->developer)) {
         $xml->writeElement("Developer", $this->description);
     }
     if (isset($this->contact)) {
         $xml->writeElement("Contact", $this->contact);
     }
     if (isset($this->attribution)) {
         $xml->writeELement("Attribution", $this->attribution);
     }
     if (isset($this->syndicationRight)) {
         $xml->writeElement("SyndicationRight", $this->syndicationRight);
     }
     if (isset($this->adultContent)) {
         $xml->writeElement("adultContent", $this->adultContent);
     }
     if (isset($this->language)) {
         if (is_array($this->language)) {
             for ($i = 0; $i < count($this->language); $i++) {
                 $xml->writeELement("Language", $this->language[$i]);
             }
         } else {
             $xml->writeElement("Language", $this->language);
         }
     }
     if (count($this->inputEncoding)) {
         if (is_array($this->inputEncoding)) {
             for ($i = 0; $i < count($this->inputEncoding); $i++) {
                 $xml->writeELement("InputEncoding", $this->inputEncoding[$i]);
             }
         } else {
             $xml->writeElement("InputEncoding", $this->inputEncoding);
         }
     }
     if (count($this->outputEncoding)) {
         if (is_array($this->outputEncoding)) {
             for ($i = 0; $i < count($this->outputEncoding); $i++) {
                 $xml->writeELement("OutputEncoding", $this->OuputEncoding[$i]);
             }
         } else {
             $xml->writeElement("OuputEncoding", $this->OuputEncoding);
         }
     }
     if (count($this->tags)) {
         $xml->writeElement("Tags", join($this->tags, " "));
     }
     if (count($this->image)) {
         $xml->startElement("Image", $this->image["location"]);
         if ($this->image["height"]) {
             $xml->writeAttribute("height", $this->image["height"]);
         }
         if ($this->image["width"]) {
             $xml->writeAttribute("width", $this->image["width"]);
         }
         if ($this->image["type"]) {
             $xml->writeAttribute("type", $this->image["type"]);
         }
         $xml->endElement();
     }
     if (count($this->indexes) || isset($this->exampleQuery)) {
         $xml->startElement("Query");
         if (isset($this->exampleQuery)) {
             $xml->writeAttribute("role", "example");
             $xml->writeAttribute("searchTerms", $this->exampleQuery);
         }
         if (count($this->indexes)) {
             $xml->startElement("zr:explain");
             $xml->writeAttribute("xmlns:zr", "http://explain.z3950.org/dtd/2.1/");
             $xml->startElement("zr:indexInfo");
             for ($i = 0; $i < count($this->indexes); $i++) {
                 $xml->startElement("zr:set");
                 $xml->writeAttribute("name", $this->indexes[$i]->name);
                 if ($this->indexes[$i]->identifier) {
                     $xml->writeAttribute("identifier", $this->indexes[$i]->identifier);
                 }
                 $xml->endELement();
                 for ($x = 0; $x < count($this->indexes[$i]->indexes); $x++) {
                     $xml->startElement("zr:index");
                     $xml->startElement("zr:map");
                     $xml->startElement("zr:name");
                     $xml->writeAttribute("set", $this->indexes[$i]->name);
                     $xml->text($this->indexes[$i]->indexes[$x]);
                     $xml->endElement();
                     $xml->endElement();
                     $xml->endELement();
                 }
             }
             $xml->endElement();
             $xml->endElement();
         }
         $xml->endElement();
     }
     $xml->endElement();
     return $xml->outputMemory(true);
 }
Example #16
0
 *
 * All what it does is parsing log and output it in reverse order (new builds 
 * first) in RSS 2.0 format.
 *
 * (C) 2007 Marcin Juszkiewicz
 *
 * License: MIT
 *
 */
$build_link_base = 'http://www.angstrom-distribution.org/core/autobuild/';
$builder_log_date = file('autobuilder.log');
if (empty($builder_log_date)) {
    die("No logs\n");
}
$builder_log_date = array_reverse($builder_log_date);
$rss_xml = new xmlWriter();
if (!$rss_xml) {
    die("Unable to create XML Writer\n");
}
$rss_xml->openMemory();
$rss_xml->startDocument('1.0', 'utf-8');
$rss_xml->startElement('rss');
$rss_xml->writeAttribute('version', '2.0');
$rss_xml->startElement('channel');
$rss_xml->writeElement('title', 'Ångström autobuilder updates');
$rss_xml->writeElement('link', $build_link_base);
$rss_xml->writeElement('description', 'Ångström autobuilder updates list');
foreach ($builder_log_date as $build) {
    $build = str_replace("\n", "", $build);
    $data = explode(' ', $build);
    $rss_xml->startElement('item');
Example #17
0
 /**
  * Serialize PHPExcel object to XML
  *
  * @param 	PHPExcel	$pPHPExcel
  * @param 	string		$pFilename
  * @return 	string 		XML Output
  * @throws 	Exception
  */
 private function _writeSerialized(PHPExcel $pPHPExcel = null, $pFilename = '')
 {
     // Clone $pPHPExcel
     $pPHPExcel = clone $pPHPExcel;
     // Update media links
     $sheetCount = $pPHPExcel->getSheetCount();
     for ($i = 0; $i < $sheetCount; ++$i) {
         for ($j = 0; $j < $pPHPExcel->getSheet($i)->getDrawingCollection()->count(); ++$j) {
             if ($pPHPExcel->getSheet($i)->getDrawingCollection()->offsetGet($j) instanceof PHPExcel_Worksheet_BaseDrawing) {
                 $imgTemp =& $pPHPExcel->getSheet($i)->getDrawingCollection()->offsetGet($j);
                 $imgTemp->setPath('zip://' . $pFilename . '#media/' . $imgTemp->getFilename(), false);
             }
         }
     }
     // Create XML writer
     $objWriter = new xmlWriter();
     $objWriter->openMemory();
     $objWriter->setIndent(true);
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // PHPExcel
     $objWriter->startElement('PHPExcel');
     $objWriter->writeAttribute('version', '##VERSION##');
     // Comment
     $objWriter->writeComment('This file has been generated using PHPExcel v##VERSION## (http://www.codeplex.com/PHPExcel). It contains a base64 encoded serialized version of the PHPExcel internal object.');
     // Data
     $objWriter->startElement('data');
     $objWriter->writeCData(base64_encode(serialize($pPHPExcel)));
     $objWriter->endElement();
     $objWriter->endElement();
     // Return
     return $objWriter->outputMemory(true);
 }
Example #18
0
 public static function build_update_xmls($data)
 {
     if (!is_array($data)) {
         return self::build_update_xml($data);
     }
     $xw = new xmlWriter();
     $xw->openMemory();
     $xw->startDocument('1.0', 'UTF-8');
     $xw->startElement('add');
     foreach ($data as $row) {
         $xw->startElement('doc');
         foreach ($row as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $v) {
                     $xw->startElement('field');
                     $xw->writeAttribute('name', $key);
                     $xw->writeCdata($v);
                     $xw->endElement();
                 }
             } else {
                 $xw->startElement('field');
                 $xw->writeAttribute('name', $key);
                 $xw->writeCdata($value);
                 $xw->endElement();
             }
         }
         $xw->endElement();
     }
     $xw->endElement();
     $xw->endDocument();
     $xml = $xw->outputMemory(true);
     return $xml;
 }