📄 wbxml.class.inc
字号:
<?php/*** @copyright Intermesh 2004* @author Merijn Schering <mschering@intermesh.nl>* @version $Revision: 1.9 $ $Date: 2006/04/10 13:21:11 $** This program is free software; you can redistribute it and/or modify it* under the terms of the GNU General Public License as published by the* Free Software Foundation; either version 2 of the License, or (at your* option) any later version.**//*** This class is used to parse and produce RFC822 formatted E-mail strings.* It was written because imap_rfc822_parse_addr_list() does a terrible job.** @package Framework* @subpackage XML * @author Merijn Schering <mschering@intermesh.nl>* @since Group-Office 2.10*/class wbxml{ /** * Temporary file for the WBXML data * * @var String * @access private */ var $wbxmlfile = '/tmp/tmp.wbxml'; /** * Temporary file for the XML data * * @var String * @access private */ var $xmlfile = '/tmp/tmp.xml'; /** * Constructor. Set's temporary file names * * @access public * @return void */ function wbxml() { global $GO_CONFIG; $this->wbxmlfile = $GO_CONFIG->tmpdir.md5(uniqid(time())).'.wbxml'; $this->xmlfile = $GO_CONFIG->tmpdir.md5(uniqid(time())).'.xml'; } /** * Converts a WBXML string to XML * * @param string wbxml The WBXML data * @access public * @return string XML */ function to_xml($wbxml) { //create temp file $fp = fopen($this->wbxmlfile, 'w+'); fwrite($fp, $wbxml); fclose($fp); //convert temp file exec('wbxml2xml -o '.$this->xmlfile.' '.$this->wbxmlfile); //read xml $wbxml = trim(file_get_contents($this->xmlfile)); //remove temp files unlink($this->xmlfile); unlink($this->wbxmlfile); return $wbxml; } /** * Converts a XML string to WBXML * * @param string wbxml The WBXML data * @access public * @return string WBXML */ function to_wbxml($xml) { //create temp file $fp = fopen($this->xmlfile, 'w+'); fwrite($fp, $xml); fclose($fp); //convert temp file exec('xml2wbxml -v 1.2 -o '.$this->wbxmlfile.' '.$this->xmlfile); //read xml $xml = trim(file_get_contents($this->wbxmlfile)); //remove temp files unlink($this->xmlfile); unlink($this->wbxmlfile); return $xml; }}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -