<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: Vista8's Code Snippets</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 05 Sep 2008 08:41:54 GMT</pubDate>
    <description>DZone Snippets: Vista8's Code Snippets</description>
    <item>
      <title>php javascript class encode</title>
      <link>http://snippets.dzone.com/posts/show/1871</link>
      <description>&lt;code&gt;&lt;br /&gt;&lt;?php &lt;br /&gt;/* &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;  | SofeeFramework for PHP 4                                             | &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;  | Copyright (c) 2004-2005 Sofee Development Team.(http://www.sofee.cn) | &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;  | This source file is subject to version 1.00 of the Sofee license,    | &lt;br /&gt;  | that is bundled with this package in the file LICENSE, and is        | &lt;br /&gt;  | available through the world-wide-web at the following url:           | &lt;br /&gt;  | http://www.sofee.cn/license/1_00.txt.                                | &lt;br /&gt;  | If you did not receive a copy of the Sofee license and are unable to | &lt;br /&gt;  | obtain it through the world-wide-web, please send a note to          | &lt;br /&gt;  | license@sofee.cn so we can mail you a copy immediately.              | &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;  | Author: Justin Wu &lt;ezdevelop@gmail.com&gt;                              | &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;*/ &lt;br /&gt;     &lt;br /&gt;/* $Id: SofeeScriptDecoder.php,v 1.1 2005/06/14 06:30:14 wenlong Exp $ */ &lt;br /&gt;&lt;br /&gt;/** &lt;br /&gt;* Sofee Script Decoder class -    Decodes JScript/VBscript data encoded with the &lt;br /&gt;*                                MS ScriptEncoder in true crossbrowser manner. &lt;br /&gt;* &lt;br /&gt;* This script was influenced by the C version (scrdec1x.c) by Mr.Brownstone, &lt;br /&gt;* and is distributed under the terms of the BSD License. &lt;br /&gt;* &lt;br /&gt;* scrdec1x.c is copyright(c) Mr.Brownstone &lt;mrbrownstone@virtualconspiracy.com&gt; &lt;br /&gt;* http://www.virtualconspiracy.com/scrdec.html &lt;br /&gt;* &lt;br /&gt;* @package        SofeeFramework &lt;br /&gt;* @access        public &lt;br /&gt;* @version        $Revision: 1.1 $ &lt;br /&gt;* @author        Justin Wu &lt;wenlong@php.net&gt; &lt;br /&gt;* @homepage        http://www.sofee.cn &lt;br /&gt;* @copyright    Copyright (c) 2004-2005 Sofee Development Team.(http://www.sofee.cn) &lt;br /&gt;* @since        2005-06-14 &lt;br /&gt;*/ &lt;br /&gt;&lt;br /&gt;define('STATE_COPY_INPUT',        100); &lt;br /&gt;define('STATE_READLEN',            101); &lt;br /&gt;define('STATE_DECODE',            102); &lt;br /&gt;define('STATE_UNESCAPE',        103); &lt;br /&gt;&lt;br /&gt;class SofeeScriptDecoder { &lt;br /&gt;    var $rawData = array ( &lt;br /&gt;        0x64,0x37,0x69, 0x50,0x7E,0x2C, 0x22,0x5A,0x65, 0x4A,0x45,0x72, &lt;br /&gt;        0x61,0x3A,0x5B, 0x5E,0x79,0x66, 0x5D,0x59,0x75, 0x5B,0x27,0x4C, &lt;br /&gt;        0x42,0x76,0x45, 0x60,0x63,0x76, 0x23,0x62,0x2A, 0x65,0x4D,0x43, &lt;br /&gt;        0x5F,0x51,0x33, 0x7E,0x53,0x42, 0x4F,0x52,0x20, 0x52,0x20,0x63, &lt;br /&gt;        0x7A,0x26,0x4A, 0x21,0x54,0x5A, 0x46,0x71,0x38, 0x20,0x2B,0x79, &lt;br /&gt;        0x26,0x66,0x32, 0x63,0x2A,0x57, 0x2A,0x58,0x6C, 0x76,0x7F,0x2B, &lt;br /&gt;        0x47,0x7B,0x46, 0x25,0x30,0x52, 0x2C,0x31,0x4F, 0x29,0x6C,0x3D, &lt;br /&gt;        0x69,0x49,0x70, 0x3F,0x3F,0x3F, 0x27,0x78,0x7B, 0x3F,0x3F,0x3F, &lt;br /&gt;        0x67,0x5F,0x51, 0x3F,0x3F,0x3F, 0x62,0x29,0x7A, 0x41,0x24,0x7E, &lt;br /&gt;        0x5A,0x2F,0x3B, 0x66,0x39,0x47, 0x32,0x33,0x41, 0x73,0x6F,0x77, &lt;br /&gt;        0x4D,0x21,0x56, 0x43,0x75,0x5F, 0x71,0x28,0x26, 0x39,0x42,0x78, &lt;br /&gt;        0x7C,0x46,0x6E, 0x53,0x4A,0x64, 0x48,0x5C,0x74, 0x31,0x48,0x67, &lt;br /&gt;        0x72,0x36,0x7D, 0x6E,0x4B,0x68, 0x70,0x7D,0x35, 0x49,0x5D,0x22, &lt;br /&gt;        0x3F,0x6A,0x55, 0x4B,0x50,0x3A, 0x6A,0x69,0x60, 0x2E,0x23,0x6A, &lt;br /&gt;        0x7F,0x09,0x71, 0x28,0x70,0x6F, 0x35,0x65,0x49, 0x7D,0x74,0x5C, &lt;br /&gt;        0x24,0x2C,0x5D, 0x2D,0x77,0x27, 0x54,0x44,0x59, 0x37,0x3F,0x25, &lt;br /&gt;        0x7B,0x6D,0x7C, 0x3D,0x7C,0x23, 0x6C,0x43,0x6D, 0x34,0x38,0x28, &lt;br /&gt;        0x6D,0x5E,0x31, 0x4E,0x5B,0x39, 0x2B,0x6E,0x7F, 0x30,0x57,0x36, &lt;br /&gt;        0x6F,0x4C,0x54, 0x74,0x34,0x34, 0x6B,0x72,0x62, 0x4C,0x25,0x4E, &lt;br /&gt;        0x33,0x56,0x30, 0x56,0x73,0x5E, 0x3A,0x68,0x73, 0x78,0x55,0x09, &lt;br /&gt;        0x57,0x47,0x4B, 0x77,0x32,0x61, 0x3B,0x35,0x24, 0x44,0x2E,0x4D, &lt;br /&gt;        0x2F,0x64,0x6B, 0x59,0x4F,0x44, 0x45,0x3B,0x21, 0x5C,0x2D,0x37, &lt;br /&gt;        0x68,0x41,0x53, 0x36,0x61,0x58, 0x58,0x7A,0x48, 0x79,0x22,0x2E, &lt;br /&gt;        0x09,0x60,0x50, 0x75,0x6B,0x2D, 0x38,0x4E,0x29, 0x55,0x3D,0x3F &lt;br /&gt;    ); &lt;br /&gt;&lt;br /&gt;    var $pick_encoding = array ( &lt;br /&gt;        1, 2, 0, 1, 2, 0, 2, 0, 0, 2, 0, 2, 1, 0, 2, 0, &lt;br /&gt;        1, 0, 2, 0, 1, 1, 2, 0, 0, 2, 1, 0, 2, 0, 0, 2, &lt;br /&gt;        1, 1, 0, 2, 0, 2, 0, 1, 0, 1, 1, 2, 0, 1, 0, 2, &lt;br /&gt;        1, 0, 2, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 1, 0, 2 &lt;br /&gt;    ); &lt;br /&gt;&lt;br /&gt;    var $transformed = array(); &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * &#35828;&#26126; &lt;br /&gt;    * &lt;br /&gt;    * @access    private &lt;br /&gt;    * @var        string &lt;br /&gt;    */ &lt;br /&gt;    var $digits; &lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;    /** &lt;br /&gt;    * Constructor &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @return        void     &lt;br /&gt;    */ &lt;br /&gt;    function SofeeScriptDecoder() { &lt;br /&gt;        $this-&gt;maketrans(); &lt;br /&gt;        $this-&gt;makedigits(); &lt;br /&gt;    } &lt;br /&gt;     &lt;br /&gt;    /** &lt;br /&gt;    * unescape a char &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @param        string        [$char] &lt;br /&gt;    * @return        string &lt;br /&gt;    */ &lt;br /&gt;    function unescape($char) { &lt;br /&gt;        $escapes = "#&amp;!*$"; &lt;br /&gt;        $escaped = "\r\n&lt;&gt;@"; &lt;br /&gt;        $i = 0; &lt;br /&gt;&lt;br /&gt;        if (ord($char) &gt; 126) { &lt;br /&gt;            return $char; &lt;br /&gt;        } &lt;br /&gt;         &lt;br /&gt;        while ($escapes[$i]) { &lt;br /&gt;            if ($escapes[$i] == $char) &lt;br /&gt;                return $escaped[$i]; &lt;br /&gt;            $i++; &lt;br /&gt;        } &lt;br /&gt;        return '?'; &lt;br /&gt;    } &lt;br /&gt;     &lt;br /&gt;    /** &lt;br /&gt;    * pre-building the char-matrix &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @return        void     &lt;br /&gt;    */ &lt;br /&gt;    function maketrans() { &lt;br /&gt;        for ($i=0; $i&lt;3; $i++) { &lt;br /&gt;            $this-&gt;transformed[$i] = array(); &lt;br /&gt;        } &lt;br /&gt;&lt;br /&gt;        for ($i=31; $i&lt;=126; $i++) { &lt;br /&gt;            for ($j=0; $j&lt;3; $j++) { &lt;br /&gt;                $this-&gt;transformed[$j][$this-&gt;rawData[($i-31)*3 + $j]] = ($i==31) ? 9 : $i; &lt;br /&gt;            } &lt;br /&gt;        } &lt;br /&gt;    } &lt;br /&gt;     &lt;br /&gt;    /** &lt;br /&gt;    * pre-building the char-matrix &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @return        void     &lt;br /&gt;    */ &lt;br /&gt;    function makedigits() { &lt;br /&gt;        for ($i=0; $i&lt;26; $i++) { &lt;br /&gt;            $this-&gt;digits[ord('A')+$i] = $i; &lt;br /&gt;            $this-&gt;digits[ord('a')+$i] = $i+26; &lt;br /&gt;        } &lt;br /&gt;        for ($i=0; $i&lt;10; $i++) { &lt;br /&gt;            $this-&gt;digits[ord('0')+$i] = $i+52; &lt;br /&gt;        } &lt;br /&gt;        $this-&gt;digits[0x2b] = 62; &lt;br /&gt;        $this-&gt;digits[0x2f] = 63; &lt;br /&gt;    } &lt;br /&gt;     &lt;br /&gt;    /** &lt;br /&gt;    * decode string length &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @param        string        [$str] &lt;br /&gt;    * @return        integer &lt;br /&gt;    */ &lt;br /&gt;    function decodeBase64($str) { &lt;br /&gt;        $val = 0; &lt;br /&gt;        $val += ($this-&gt;digits[ord($str[0])] &lt;&lt; 2); &lt;br /&gt;        $val += ($this-&gt;digits[ord($str[1])] &gt;&gt; 4); &lt;br /&gt;        $val += ($this-&gt;digits[ord($str[1])] &amp; 0xf) &lt;&lt; 12; &lt;br /&gt;        $val += (($this-&gt;digits[ord($str[2])] &gt;&gt; 2) &lt;&lt; 8); &lt;br /&gt;        $val += (($this-&gt;digits[ord($str[2])] &amp; 0x3) &lt;&lt; 22); &lt;br /&gt;        $val += ($this-&gt;digits[ord($str[3])] &lt;&lt; 16); &lt;br /&gt;        return $val; &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * Decodes JScript/VBscript data encoded with the MS ScriptEncoder in true crossbrowser manner. &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @param        string        [$str] &lt;br /&gt;    * @return        string     &lt;br /&gt;    */ &lt;br /&gt;    function decode($str) { &lt;br /&gt;        $marker = "#@~^"; &lt;br /&gt;        $strIdx = 0; &lt;br /&gt;        $scrIdx = 0; &lt;br /&gt;        $decIdx = 0; &lt;br /&gt;        $char = null; &lt;br /&gt;        $strLen = $scrLen = 0; &lt;br /&gt;        $state = STATE_COPY_INPUT; &lt;br /&gt;        $ret = ""; &lt;br /&gt;&lt;br /&gt;        while ($state) { &lt;br /&gt;            switch ($state) { &lt;br /&gt;                case STATE_COPY_INPUT : &lt;br /&gt;                    $scrIdx = strpos($str, $marker, $strIdx); &lt;br /&gt;                    if ($scrIdx !== false) { &lt;br /&gt;                        $ret .= substr($str, $strIdx, $scrIdx); &lt;br /&gt;                        $scrIdx += strlen($marker); &lt;br /&gt;                        $state = STATE_READLEN; &lt;br /&gt;                    } else { &lt;br /&gt;                        $strIdx = $strIdx==0 ? 0 : $strIdx; &lt;br /&gt;                        $ret .= substr($str, $strIdx, strlen($str)); &lt;br /&gt;                        $state = 0; &lt;br /&gt;                    } &lt;br /&gt;                    break; &lt;br /&gt;                         &lt;br /&gt;                case STATE_READLEN : &lt;br /&gt;                    $strLen = substr($str, $scrIdx, 6); &lt;br /&gt;                    $scrLen = $this-&gt;decodeBase64($strLen); &lt;br /&gt;                    $scrIdx += (6 + strlen("==")); &lt;br /&gt;                    $state = STATE_DECODE; &lt;br /&gt;                    break; &lt;br /&gt;                 &lt;br /&gt;                case STATE_DECODE : &lt;br /&gt;                    if (!$scrLen) { &lt;br /&gt;                        $strIdx = $scrIdx + strlen("DQgAAA==^#~@"); &lt;br /&gt;                        $decIdx = 0; &lt;br /&gt;                        $state = STATE_COPY_INPUT; &lt;br /&gt;                        break; &lt;br /&gt;                    } &lt;br /&gt;                    $char = substr($str, $scrIdx, 1); &lt;br /&gt;                    if ($char == "@") { &lt;br /&gt;                        $state = STATE_UNESCAPE; &lt;br /&gt;                    } else { &lt;br /&gt;                        if (ord($char[0]) &lt; 0x80) { &lt;br /&gt;                            $ret .= chr($this-&gt;transformed[$this-&gt;pick_encoding[$decIdx%64]][ord($char)]); &lt;br /&gt;                            $decIdx++; &lt;br /&gt;                        } else { &lt;br /&gt;                            $ret .= $char; &lt;br /&gt;                            if ( &lt;br /&gt;                                (ord($char) &gt; 0xa0) &amp;&amp; (ord($char) &lt; 0xff)    // 936 - Simplified Chinese GBK    -    0xa1-0xfe &lt;br /&gt;                                || (ord($char) &gt; 0x80) &amp;&amp; (ord($char) &lt; 0xff)    // 950 - Traditional Chinese Big5    -    0x81-0xfe &lt;br /&gt;                            ) { &lt;br /&gt;                                $scrIdx++; &lt;br /&gt;                                $scrLen--; &lt;br /&gt;                                $ret .= substr($str, $scrIdx, 1); &lt;br /&gt;                            } &lt;br /&gt;                        } &lt;br /&gt;                        $scrIdx++; &lt;br /&gt;                        $scrLen--; &lt;br /&gt;                        break; &lt;br /&gt;                    } &lt;br /&gt;                     &lt;br /&gt;                case STATE_UNESCAPE: &lt;br /&gt;                    $ret .= $this-&gt;unescape(substr($str, ++$scrIdx, 1)); &lt;br /&gt;                    $scrIdx++; &lt;br /&gt;                    $scrLen -= 2; &lt;br /&gt;                    $decIdx++; &lt;br /&gt;                    $state = STATE_DECODE; &lt;br /&gt;                    break; &lt;br /&gt;            } &lt;br /&gt;        } &lt;br /&gt;        return ($ret); &lt;br /&gt;    } &lt;br /&gt;} &lt;br /&gt;?&gt; &lt;br /&gt;&lt;br /&gt;&#35843;&#29992;&#26041;&#27861;&#65306;&lt;br /&gt;&lt;?php &lt;br /&gt;require_once('SofeeScriptDecoder.php'); &lt;br /&gt;&lt;br /&gt;$scr = new SofeeScriptDecoder(); &lt;br /&gt;$str = file_get_contents('test.txt'); &lt;br /&gt;&lt;br /&gt;echo $scr-&gt;decode($str); &lt;br /&gt;?&gt; &lt;br /&gt;&lt;br /&gt;test.txt&#25991;&#20214;&#20869;&#23481;&#65306;&lt;br /&gt;#@~^8wIAAA==@!4Yh^@*@#@&amp;@!DkDs+@*nunUlsG RmKh@!JYkDsn@*@#@&amp;@!4GNz@*@#@&amp;@!/1.kaY~smxo;CT+xJNC7ld1DbwYr@*@#@&amp;0!x^YbWU~T+YohV}4L^O`*PP@#@&amp;d-CMPG4N~',x;s^i@#@&amp;7DDzPP@#@&amp;d7K4NP',xAPzmOk7+p6(L+1O`rH/Xhs c(tSuKPKr#I@#@&amp;78,mCO1t`nb, @#@&amp;i7DDz, @#@&amp;didK8L,'~xh~)1Yk7n(}4L^O`rHbm.WdG6Y (tJC:KKE*i@#@&amp;7i8~mmO1tcKm*P @#@&amp;i7db0~`DX2nK0Po\S_YYa]n;!+kY~"x~rEUNWk +[E,#P`@#@&amp;d7diG(L~{P +h,(tJCDY2I;;nkY`*I@#@&amp;ddiN@#@&amp;id)@#@&amp;dN@#@&amp;d.+D;D PG8Ni@#@&amp;N@#@&amp;@#@&amp;6; mObW PoY}8LmO`bNb~P@#@&amp;ir0,`NK^;:xDRL+O3^+h+ OAHq[b, @#@&amp;7iDnY!. P[Km!:+ YcL+D2s+s+UO~Xq9ck9#i@#@&amp;78,+^/nPrW,`[W1;:xO mVVb~P@#@&amp;di.Y;Mx,NW1EsnxDRCV^$r[Yi@#@&amp;78,+Vkn~k6PvNGm;hxOR^CXDdb, @#@&amp;7iDnY!. P[Km!:+ YcslH+./]k[Dp@#@&amp;iN@#@&amp;8@#@&amp;@#@&amp;l^+MYcB n^mG:~YKPKuh?lsG R^WsZE#I@#@&amp;@!z/1Db2Y@*@#@&amp;@!J4G[H@*@#@&amp;@!z4Y:^@*Hs8AAA==^#~@&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&#35299;&#23494;&#32467;&#26524;&#65306;&lt;br /&gt;&lt;html&gt; &lt;br /&gt;&lt;title&gt;PHPSalon.com&lt;/title&gt; &lt;br /&gt;&lt;body&gt; &lt;br /&gt;&lt;script language="javascript"&gt; &lt;br /&gt;function getXmlObject() { &lt;br /&gt;    var obj = null; &lt;br /&gt;    try { &lt;br /&gt;        obj = new ActiveXObject("Msxml2.XMLHTTP"); &lt;br /&gt;    } catch(e) { &lt;br /&gt;        try { &lt;br /&gt;            obj = new ActiveXObject("Microsoft.XMLHTTP"); &lt;br /&gt;        } catch(oc) { &lt;br /&gt;            if (typeof XMLHttpRequest != "undefined" ) { &lt;br /&gt;                obj = new XMLHttpRequest(); &lt;br /&gt;            } &lt;br /&gt;        } &lt;br /&gt;    } &lt;br /&gt;    return obj; &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;function getObject(id) { &lt;br /&gt;    if (document.getElementById) { &lt;br /&gt;        return document.getElementById(id); &lt;br /&gt;    } else if (document.all) { &lt;br /&gt;        return document.all[id]; &lt;br /&gt;    } else if (document.layers) { &lt;br /&gt;        return document.layers[id]; &lt;br /&gt;    } &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;alert('Welcome to PHPSalon.com!'); &lt;br /&gt;&lt;/script&gt; &lt;br /&gt;&lt;/body&gt; &lt;br /&gt;&lt;/html&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 09 Apr 2006 21:35:29 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1871</guid>
      <author>vista8 (joe)</author>
    </item>
    <item>
      <title>php xml class</title>
      <link>http://snippets.dzone.com/posts/show/1870</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&#229;&#164;&#167;&#229;&#174;&#182;&#233;&#402;&#189;&#231;&#376;&#165;&#233;?&#8220;PHP4&#228;&#184;&#173;&#230;&#178;&#161;&#230;&#339;&#8240;SimpleXML&#230;&#8240;&#169;&#229;&#177;&#8226;&#239;&#188;&#338;&#232;&#166;?XML&#232;&#167;&#163;&#230;&#382;?&#230;&#710;?&#230;&#8226;&#176;&#231;&#187;&#8222;&#230;&#732;&#175;&#228;&#187;&#182;&#233;&#186;&#187;&#231;&#402;&#166;&#231;&#353;&#8222;&#228;&#186;&#8249;&#239;&#188;&#338;&#230;&#339;&#8364;&#232;&#191;&#8216;&#230;&#173;&#163;&#229;&#165;&#189;&#231;&#8221;&#168;&#229;&#710;&#176;&#231;&#8250;&#184;&#229;&#8230;&#179;&#230;&#352;&#8364;&#230;&#339;&#175;&#239;&#188;&#338;&#228;&#186;&#381;&#230;&#732;&#175;&#229;&#176;&#177;&#232;&#8225;&#170;&#229;&#183;&#177;&#229;&#8224;&#8482;&#228;&#184;&#8364;&#228;&#184;&#170;&#239;&#188;&#338;&#228;&#187;&#165;&#228;&#184;&#8249;&#230;&#732;&#175;&#230;&#186;?&#228;&#187;&#163;&#231;&#160;?&#239;&#188;&#353;&lt;br /&gt;&lt;br /&gt;SofeeXmlParser.php&lt;br /&gt;&lt;?php &lt;br /&gt;/* &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;  | SofeeFramework for PHP 4                                             | &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;  | Copyright (c) 2004-2005 Sofee Development Team.(http://www.sofee.cn) | &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;  | This source file is subject to version 1.00 of the Sofee license,    | &lt;br /&gt;  | that is bundled with this package in the file LICENSE, and is        | &lt;br /&gt;  | available through the world-wide-web at the following url:           | &lt;br /&gt;  | http://www.sofee.cn/license/1_00.txt.                                | &lt;br /&gt;  | If you did not receive a copy of the Sofee license and are unable to | &lt;br /&gt;  | obtain it through the world-wide-web, please send a note to          | &lt;br /&gt;  | license@sofee.cn so we can mail you a copy immediately.              | &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;  | Author: Justin Wu &lt;ezdevelop@gmail.com&gt;                              | &lt;br /&gt;  +----------------------------------------------------------------------+ &lt;br /&gt;*/ &lt;br /&gt;     &lt;br /&gt;/* $Id: SofeeXmlParser.php,v 1.3 2005/05/30 06:30:14 wenlong Exp $ */ &lt;br /&gt;&lt;br /&gt;/** &lt;br /&gt;* Sofee XML Parser class - This is an XML parser based on PHP's "xml" extension. &lt;br /&gt;* &lt;br /&gt;* The SofeeXmlParser class provides a very simple and easily usable toolset to convert XML &lt;br /&gt;* to an array that can be processed with array iterators. &lt;br /&gt;* &lt;br /&gt;* @package        SofeeFramework &lt;br /&gt;* @access        public &lt;br /&gt;* @version        $Revision: 1.1 $ &lt;br /&gt;* @author        Justin Wu &lt;wenlong@php.net&gt; &lt;br /&gt;* @homepage        http://www.sofee.cn &lt;br /&gt;* @copyright    Copyright (c) 2004-2005 Sofee Development Team.(http://www.sofee.cn) &lt;br /&gt;* @since        2005-05-30 &lt;br /&gt;* @see            PEAR:XML_Parser | SimpleXML extension &lt;br /&gt;*/ &lt;br /&gt;class SofeeXmlParser { &lt;br /&gt;     &lt;br /&gt;    /** &lt;br /&gt;    * XML parser handle &lt;br /&gt;    * &lt;br /&gt;    * @var        resource &lt;br /&gt;    * @see        xml_parser_create() &lt;br /&gt;    */ &lt;br /&gt;    var $parser; &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * source encoding &lt;br /&gt;    * &lt;br /&gt;    * @var        string &lt;br /&gt;    */ &lt;br /&gt;    var $srcenc; &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * target encoding &lt;br /&gt;    * &lt;br /&gt;    * @var        string &lt;br /&gt;    */ &lt;br /&gt;    var $dstenc; &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * the original struct &lt;br /&gt;    * &lt;br /&gt;    * @access    private &lt;br /&gt;    * @var        array &lt;br /&gt;    */ &lt;br /&gt;    var $_struct = array(); &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * Constructor &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @param        mixed        [$srcenc] source encoding &lt;br /&gt;    * @param        mixed        [$dstenc] target encoding &lt;br /&gt;    * @return        void &lt;br /&gt;    * @since         &lt;br /&gt;    */ &lt;br /&gt;    function SofeeXmlParser($srcenc = null, $dstenc = null) { &lt;br /&gt;        $this-&gt;srcenc = $srcenc; &lt;br /&gt;        $this-&gt;dstenc = $dstenc; &lt;br /&gt;         &lt;br /&gt;        // initialize the variable. &lt;br /&gt;        $this-&gt;parser = null; &lt;br /&gt;        $this-&gt;_struct = array(); &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * Free the resources &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @return        void &lt;br /&gt;    **/ &lt;br /&gt;    function free() { &lt;br /&gt;        if (isset($this-&gt;parser) &amp;&amp; is_resource($this-&gt;parser)) { &lt;br /&gt;            xml_parser_free($this-&gt;parser); &lt;br /&gt;            unset($this-&gt;parser); &lt;br /&gt;        } &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * Parses the XML file &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @param        string        [$file] the XML file name &lt;br /&gt;    * @return        void &lt;br /&gt;    * @since         &lt;br /&gt;    */ &lt;br /&gt;    function parseFile($file) { &lt;br /&gt;        $data = @file_get_contents($file) or die("Can't open file $file for reading!"); &lt;br /&gt;        $this-&gt;parseString($data); &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * Parses a string. &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @param        string        [$data] XML data &lt;br /&gt;    * @return        void &lt;br /&gt;    */ &lt;br /&gt;    function parseString($data) { &lt;br /&gt;        if ($this-&gt;srcenc === null) { &lt;br /&gt;            $this-&gt;parser = @xml_parser_create() or die('Unable to create XML parser resource.'); &lt;br /&gt;        } else { &lt;br /&gt;            $this-&gt;parser = @xml_parser_create($this-&gt;srcenc) or die('Unable to create XML parser resource with '. $this-&gt;srcenc .' encoding.'); &lt;br /&gt;        } &lt;br /&gt;         &lt;br /&gt;        if ($this-&gt;dstenc !== null) { &lt;br /&gt;            @xml_parser_set_option($this-&gt;parser, XML_OPTION_TARGET_ENCODING, $this-&gt;dstenc) or die('Invalid target encoding'); &lt;br /&gt;        } &lt;br /&gt;        xml_parser_set_option($this-&gt;parser, XML_OPTION_CASE_FOLDING, 0);    // lowercase tags &lt;br /&gt;        xml_parser_set_option($this-&gt;parser, XML_OPTION_SKIP_WHITE, 1);        // skip empty tags &lt;br /&gt;        if (!xml_parse_into_struct($this-&gt;parser, $data, &amp;$this-&gt;_struct)) { &lt;br /&gt;            printf("XML error: %s at line %d", &lt;br /&gt;                    xml_error_string(xml_get_error_code($this-&gt;parser)), &lt;br /&gt;                    xml_get_current_line_number($this-&gt;parser) &lt;br /&gt;            ); &lt;br /&gt;            $this-&gt;free(); &lt;br /&gt;            exit(); &lt;br /&gt;        } &lt;br /&gt;         &lt;br /&gt;        $this-&gt;_count = count($this-&gt;_struct); &lt;br /&gt;        $this-&gt;free(); &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * return the data struction &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @return        array &lt;br /&gt;    */ &lt;br /&gt;    function getTree() { &lt;br /&gt;        $i = 0; &lt;br /&gt;        $tree = array(); &lt;br /&gt;&lt;br /&gt;        $tree = $this-&gt;addNode( &lt;br /&gt;            $tree, &lt;br /&gt;            $this-&gt;_struct[$i]['tag'], &lt;br /&gt;            (isset($this-&gt;_struct[$i]['value'])) ? $this-&gt;_struct[$i]['value'] : '', &lt;br /&gt;            (isset($this-&gt;_struct[$i]['attributes'])) ? $this-&gt;_struct[$i]['attributes'] : '', &lt;br /&gt;            $this-&gt;getChild($i) &lt;br /&gt;        ); &lt;br /&gt;&lt;br /&gt;        unset($this-&gt;_struct); &lt;br /&gt;        return ($tree); &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * recursion the children node data &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @param        integer        [$i] the last struct index &lt;br /&gt;    * @return        array &lt;br /&gt;    */ &lt;br /&gt;    function getChild(&amp;$i) { &lt;br /&gt;        // contain node data &lt;br /&gt;        $children = array(); &lt;br /&gt;&lt;br /&gt;        // loop &lt;br /&gt;        while (++$i &lt; $this-&gt;_count) { &lt;br /&gt;            // node tag name &lt;br /&gt;            $tagname = $this-&gt;_struct[$i]['tag']; &lt;br /&gt;            $value = isset($this-&gt;_struct[$i]['value']) ? $this-&gt;_struct[$i]['value'] : ''; &lt;br /&gt;            $attributes = isset($this-&gt;_struct[$i]['attributes']) ? $this-&gt;_struct[$i]['attributes'] : ''; &lt;br /&gt;&lt;br /&gt;            switch ($this-&gt;_struct[$i]['type']) { &lt;br /&gt;                case 'open': &lt;br /&gt;                    // node has more children &lt;br /&gt;                    $child = $this-&gt;getChild($i); &lt;br /&gt;                    // append the children data to the current node &lt;br /&gt;                    $children = $this-&gt;addNode($children, $tagname, $value, $attributes, $child); &lt;br /&gt;                    break; &lt;br /&gt;                case 'complete': &lt;br /&gt;                    // at end of current branch &lt;br /&gt;                    $children = $this-&gt;addNode($children, $tagname, $value, $attributes); &lt;br /&gt;                    break; &lt;br /&gt;                case 'cdata': &lt;br /&gt;                    // node has CDATA after one of it's children &lt;br /&gt;                    $children['value'] .= $value; &lt;br /&gt;                    break; &lt;br /&gt;                case 'close': &lt;br /&gt;                    // end of node, return collected data &lt;br /&gt;                    return $children; &lt;br /&gt;                    break; &lt;br /&gt;            } &lt;br /&gt;         &lt;br /&gt;        } &lt;br /&gt;        //return $children; &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;    /** &lt;br /&gt;    * Appends some values to an array &lt;br /&gt;    * &lt;br /&gt;    * @access        public &lt;br /&gt;    * @param        array        [$target] &lt;br /&gt;    * @param        string        [$key] &lt;br /&gt;    * @param        string        [$value] &lt;br /&gt;    * @param        array        [$attributes] &lt;br /&gt;    * @param        array        [$inner] the children &lt;br /&gt;    * @return        void &lt;br /&gt;    * @since         &lt;br /&gt;    */ &lt;br /&gt;    function addNode($target, $key, $value = '', $attributes = '', $child = '') { &lt;br /&gt;        if (!isset($target[$key]['value']) &amp;&amp; !isset($target[$key][0])) { &lt;br /&gt;            if ($child != '') { &lt;br /&gt;                $target[$key] = $child; &lt;br /&gt;            } &lt;br /&gt;            if ($attributes != '') { &lt;br /&gt;                foreach ($attributes as $k =&gt; $v) { &lt;br /&gt;                    $target[$key][$k] = $v; &lt;br /&gt;                } &lt;br /&gt;            } &lt;br /&gt;             &lt;br /&gt;            $target[$key]['value'] = $value; &lt;br /&gt;        } else { &lt;br /&gt;            if (!isset($target[$key][0])) { &lt;br /&gt;                // is string or other &lt;br /&gt;                $oldvalue = $target[$key]; &lt;br /&gt;                $target[$key] = array(); &lt;br /&gt;                $target[$key][0] = $oldvalue; &lt;br /&gt;                $index = 1; &lt;br /&gt;            } else { &lt;br /&gt;                // is array &lt;br /&gt;                $index = count($target[$key]); &lt;br /&gt;            } &lt;br /&gt;&lt;br /&gt;            if ($child != '') { &lt;br /&gt;                $target[$key][$index] = $child; &lt;br /&gt;            } &lt;br /&gt;&lt;br /&gt;            if ($attributes != '') { &lt;br /&gt;                foreach ($attributes as $k =&gt; $v) { &lt;br /&gt;                    $target[$key][$index][$k] = $v; &lt;br /&gt;                } &lt;br /&gt;            } &lt;br /&gt;            $target[$key][$index]['value'] = $value; &lt;br /&gt;        } &lt;br /&gt;        return $target; &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&#232;&#176;&#402;&#231;&#8221;&#168;&#230;&#8211;&#185;&#229;&#188;?&#239;&#188;&#353;&lt;br /&gt;&lt;?php &lt;br /&gt;$file = 'test.xml'; &lt;br /&gt;require_once('SofeeXmlParser.php'); &lt;br /&gt;$xml = new SofeeXmlParser(); &lt;br /&gt;$xml-&gt;parseFile($file); &lt;br /&gt;$tree = $xml-&gt;getTree(); &lt;br /&gt;unset($xml); &lt;br /&gt;print "&lt;pre&gt;"; &lt;br /&gt;print_r($tree); &lt;br /&gt;print "&lt;/pre&gt;"; &lt;br /&gt;?&gt; &lt;br /&gt;&lt;br /&gt;test.xml&#230;&#8211;&#8225;&#228;&#187;&#182;&#229;&#8224;&#8230;&#229;&#174;&#185;&#239;&#188;&#353;&lt;br /&gt;&lt;?xml version="1.0" encoding="GBK"?&gt;&lt;br /&gt;&lt;nba update="2005-06-07"&gt;&lt;br /&gt;    &lt;team id="46"&gt;&#231;&#353;&#8225;&#229;&#174;&#182;&#233;&#169;&#172;&#229;&#190;&#183;&#233;&#8225;&#338;&lt;/team&gt;        &lt;br /&gt;    &lt;team id="47"&gt;&#229;&#176;&#164;&#230;&#8211;&#8225;&#229;&#8250;&#190;&#230;&#8211;&#175;&lt;/team&gt;    &lt;br /&gt;    &lt;team id="51"&gt;&#231;?&#171;&#231;&#174;&#173;&lt;/team&gt;&lt;br /&gt;    &lt;team id="52"&gt;&#230;&#178;&#402;&#229;&#176;&#8221;&#229;&#164;&#171;&#230;&#8211;&#175;&#229;&#160;&#161;&lt;/team&gt;&lt;br /&gt;    &lt;team id="53"&gt;&#229;&#183;&#180;&#229;&#161;&#382;&#231;&#189;&#8212;&#233;&#8218;&#163;&lt;/team&gt;&lt;br /&gt;    &lt;team id="54"&gt;&#229;&#164;&#170;&#233;&#732;&#179;&lt;/team&gt;&lt;br /&gt;&lt;/nba&gt; &lt;br /&gt;&lt;br /&gt;&#232;&#190;&#8220;&#229;&#8225;&#186;&#231;&#187;&#8220;&#230;&#382;&#339;&#239;&#188;&#353;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Array&lt;br /&gt;(&lt;br /&gt;    [nba] =&gt; Array&lt;br /&gt;        (&lt;br /&gt;            [team] =&gt; Array&lt;br /&gt;                (&lt;br /&gt;                    [0] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 46&lt;br /&gt;                            [value] =&gt; &#231;&#353;&#8225;&#229;&#174;&#182;&#233;&#169;&#172;&#229;&#190;&#183;&#233;&#8225;&#338;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [1] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 47&lt;br /&gt;                            [value] =&gt; &#229;&#176;&#164;&#230;&#8211;&#8225;&#229;&#8250;&#190;&#230;&#8211;&#175;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [2] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 51&lt;br /&gt;                            [value] =&gt; &#231;?&#171;&#231;&#174;&#173;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [3] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 52&lt;br /&gt;                            [value] =&gt; &#230;&#178;&#402;&#229;&#176;&#8221;&#229;&#164;&#171;&#230;&#8211;&#175;&#229;&#160;&#161;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [4] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 53&lt;br /&gt;                            [value] =&gt; &#229;&#183;&#180;&#229;&#161;&#382;&#231;&#189;&#8212;&#233;&#8218;&#163;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [5] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 54&lt;br /&gt;                            [value] =&gt; &#229;&#164;&#170;&#233;&#732;&#179;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                )&lt;br /&gt;&lt;br /&gt;            [update] =&gt; 2005-06-07&lt;br /&gt;            [value] =&gt; &lt;br /&gt;        )&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Array&lt;br /&gt;(&lt;br /&gt;    [nba] =&gt; Array&lt;br /&gt;        (&lt;br /&gt;            [team] =&gt; Array&lt;br /&gt;                (&lt;br /&gt;                    [0] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 46&lt;br /&gt;                            [value] =&gt; &#231;&#353;&#8225;&#229;&#174;&#182;&#233;&#169;&#172;&#229;&#190;&#183;&#233;&#8225;&#338;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [1] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 47&lt;br /&gt;                            [value] =&gt; &#229;&#176;&#164;&#230;&#8211;&#8225;&#229;&#8250;&#190;&#230;&#8211;&#175;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [2] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 51&lt;br /&gt;                            [value] =&gt; &#231;?&#171;&#231;&#174;&#173;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [3] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 52&lt;br /&gt;                            [value] =&gt; &#230;&#178;&#402;&#229;&#176;&#8221;&#229;&#164;&#171;&#230;&#8211;&#175;&#229;&#160;&#161;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [4] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 53&lt;br /&gt;                            [value] =&gt; &#229;&#183;&#180;&#229;&#161;&#382;&#231;&#189;&#8212;&#233;&#8218;&#163;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                    [5] =&gt; Array&lt;br /&gt;                        (&lt;br /&gt;                            [id] =&gt; 54&lt;br /&gt;                            [value] =&gt; &#229;&#164;&#170;&#233;&#732;&#179;&lt;br /&gt;                        )&lt;br /&gt;&lt;br /&gt;                )&lt;br /&gt;&lt;br /&gt;            [update] =&gt; 2005-06-07&lt;br /&gt;            [value] =&gt; &lt;br /&gt;        )&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 09 Apr 2006 21:26:32 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1870</guid>
      <author>vista8 (joe)</author>
    </item>
    <item>
      <title>ubb function</title>
      <link>http://snippets.dzone.com/posts/show/1865</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Function UBB(str) &lt;br /&gt;&lt;br /&gt;dim i,temp &#226;&#8364;&#732;&#229;&#163;&#176;&#230;&#732;&#381;&#229;?&#732;&#233;&#8225;? &lt;br /&gt;&lt;br /&gt;i=1 &lt;br /&gt;&lt;br /&gt;temp="" &lt;br /&gt;&lt;br /&gt;do while instr(i,str,"[/"]&gt;=1&#227;&#8364;&#8364;&#226;&#8364;&#732;&#229;&#166;&#8218;&#230;&#382;&#339;&#230;&#178;&#161;&#230;&#339;&#8240;&#232;&#190;&#190;&#229;&#710;&#176;&#229;&#173;&#8212;&#231;&#172;&#166;&#228;&#184;&#178;&#231;&#353;&#8222;&#230;&#339;&#171;&#229;&#176;&#190; &lt;br /&gt;&lt;br /&gt;if trim(temp)="" then &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\)(\S+)(\ )",str,"&lt;i&gt;$2&lt;/i&gt;")&#227;&#8364;&#8364;&#227;&#8364;&#8364;&#226;&#8364;&#732;&#232;&#191;&#8250;&#232;&#161;&#338;UBB&#228;&#187;&#163;&#231;&#160;?&#231;&#353;&#8222;&#230;&#168;&#161;&#231;&#8240;&#710;&#229;&#338;&#185;&#233;&#8230;?&#228;&#184;&#381;&#230;&#8250;&#191;&#230;?&#162; &lt;br /&gt;&lt;br /&gt;else &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\)(\S+)(\ )",temp,"&lt;i&gt;$2&lt;/i&gt;")&#227;&#8364;&#8364;&#227;&#8364;&#8364;&#226;&#8364;&#732;&#232;&#191;&#8250;&#232;&#161;&#338;UBB&#228;&#187;&#163;&#231;&#160;?&#231;&#353;&#8222;&#230;&#168;&#161;&#231;&#8240;&#710;&#229;&#338;&#185;&#233;&#8230;?&#228;&#184;&#381;&#230;&#8250;&#191;&#230;?&#162; &lt;br /&gt;&lt;br /&gt;end if &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\)(\S+)(\ )",temp,"&lt;b&gt;$2&lt;/b&gt;")&#227;&#8364;&#8364;&#227;&#8364;&#8364;&#226;&#8364;&#732;&#232;&#191;&#8250;&#232;&#161;&#338;UBB&#228;&#187;&#163;&#231;&#160;?&#231;&#353;&#8222;&#230;&#168;&#161;&#231;&#8240;&#710;&#229;&#338;&#185;&#233;&#8230;?&#228;&#184;&#381;&#230;&#8250;&#191;&#230;?&#162; &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[big])(\S+)(\[/big])",temp,"&lt;big&gt;$2&lt;/big&gt;")&#227;&#8364;&#8364;&#226;&#8364;&#732;&#232;&#191;&#8250;&#232;&#161;&#338;UBB&#228;&#187;&#163;&#231;&#160;?&#231;&#353;&#8222;&#230;&#168;&#161;&#231;&#8240;&#710;&#229;&#338;&#185;&#233;&#8230;?&#228;&#184;&#381;&#230;&#8250;&#191;&#230;?&#162; &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[strike])(\S+)(\[/strike])",temp,"&lt;strike&gt;$2&lt;/strike&gt;")&#226;&#8364;&#732;&#232;&#191;&#8250;&#232;&#161;&#338;UBB&#228;&#187;&#163;&#231;&#160;?&#231;&#353;&#8222;&#230;&#168;&#161;&#231;&#8240;&#710;&#229;&#338;&#185;&#233;&#8230;?&#228;&#184;&#381;&#230;&#8250;&#191;&#230;?&#162; &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[sub])(\S+)(\[/sub])",temp,"&lt;sub&gt;$2&lt;/sub&gt;")&#226;&#8364;&#732;&#232;&#191;&#8250;&#232;&#161;&#338;UBB&#228;&#187;&#163;&#231;&#160;?&#231;&#353;&#8222;&#230;&#168;&#161;&#231;&#8240;&#710;&#229;&#338;&#185;&#233;&#8230;?&#228;&#184;&#381;&#230;&#8250;&#191;&#230;?&#162; &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[sup])(\S+)(\[/sup])",temp,"&lt;sup&gt;$2&lt;/sup&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[pre])(\S+)(\[/pre])",temp,"&lt;pre&gt;$2&lt;/pre&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[u])(\S+)(\[/u])",temp,"&lt;u&gt;$2&lt;/u&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[small])(\S+)(\[/small])",temp,"&lt;small&gt;$2&lt;/small&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[h1])(\S+)(\[/h1])",temp,"&lt;h1&gt;$2&lt;/h1&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[h2])(\S+)(\[/h2])",temp,"&lt;h2&gt;$2&lt;/h2&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[h3])(\S+)(\[/h3])",temp,"&lt;h3&gt;$2&lt;/h3&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[h4])(\S+)(\[/h4])",temp,"&lt;h4&gt;$2&lt;/h4&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[h5])(\S+)(\[/h5])",temp,"&lt;h5&gt;$2&lt;/h5&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[h6])(\S+)(\[/h6])",temp,"&lt;h6&gt;$2&lt;/h6&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[red])(\S+)(\[/red])",temp,"&lt;font color=red&gt;$2&lt;/font&gt;") &lt;br /&gt;&lt;br /&gt;'&#232;&#191;&#8482;&#233;&#8225;&#338;&#229;?&#175;&#228;&#187;&#165;&#229;&#162;&#382;&#229;&#352;&#160;&#230;&#8211;&#176;&#231;&#353;&#8222;UBB&#228;&#187;&#163;&#231;&#160;?&#231;&#353;&#8222;&#229;&#174;&#382;&#231;&#381;&#176;&#230;&#168;&#161;&#231;&#8240;&#710; &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[email])(\S+)(\[/email])",temp,"&lt;a href=""mailto:$2"" target=_top&gt;$2&lt;/a&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[img])(\S+)(\[/img])",temp,"&lt;img src=""$2""&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[url])(\S+)(\[/url])",temp,"&lt;a href=""$2"" target=_top&gt;$2&lt;/a&gt;") &lt;br /&gt;&lt;br /&gt;temp=ReplaceTest("(\[#(\S+)])(\S+)(\[/#])",temp,"&lt;font color=$1&gt;$3&lt;/font&gt;")&#226;&#8364;&#732;&#232;&#191;&#8250;&#232;&#161;&#338;UBB&#228;&#187;&#163;&#231;&#160;?&#231;&#353;&#8222;&#230;&#168;&#161;&#231;&#8240;&#710;&#229;&#338;&#185;&#233;&#8230;?&#228;&#184;&#381;&#230;&#8250;&#191;&#230;?&#162; &lt;br /&gt;&lt;br /&gt;i=i+1 &lt;br /&gt;&lt;br /&gt;loop &lt;br /&gt;&lt;br /&gt;if trim(temp)&lt;&gt;"" then &lt;br /&gt;&lt;br /&gt;UBB=temp&#227;&#8364;&#8364;&#226;&#8364;&#732;&#229;&#176;&#8224;&#231;&#187;?&#232;&#191;&#8225;UBB&#228;&#187;&#163;&#231;&#160;?&#232;&#191;&#8225;&#230;&#187;&#164;&#229;?&#381;&#231;&#353;&#8222;&#229;&#173;&#8212;&#231;&#172;&#166;&#228;&#184;&#178;&#228;&#188;&#160;&#229;&#8225;&#186; &lt;br /&gt;&lt;br /&gt;else &lt;br /&gt;&lt;br /&gt;UBB=str&#227;&#8364;&#8364;&#227;&#8364;&#8364;&#226;&#8364;&#732;&#229;&#176;&#8224;&#231;&#187;?&#232;&#191;&#8225;UBB&#228;&#187;&#163;&#231;&#160;?&#232;&#191;&#8225;&#230;&#187;&#164;&#229;?&#381;&#231;&#353;&#8222;&#229;&#173;&#8212;&#231;&#172;&#166;&#228;&#184;&#178;&#228;&#188;&#160;&#229;&#8225;&#186; &lt;br /&gt;&lt;br /&gt;end if &lt;br /&gt;&lt;br /&gt;end function &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 08 Apr 2006 15:19:45 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1865</guid>
      <author>vista8 (joe)</author>
    </item>
    <item>
      <title>4&#232;&#710;?5&#229;&#8230;&#165;</title>
      <link>http://snippets.dzone.com/posts/show/1864</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;    $someval = 4.9;&lt;br /&gt;    $ceiled = ceil($someval);&lt;br /&gt;    $floored = floor($someval);&lt;br /&gt;?&gt; &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 08 Apr 2006 12:38:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1864</guid>
      <author>vista8 (joe)</author>
    </item>
    <item>
      <title>dojo/window/slidshow</title>
      <link>http://snippets.dzone.com/posts/show/1863</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;/*&lt;br /&gt; * Created on 2006-4-7&lt;br /&gt; *&lt;br /&gt; * To change the template for this generated file go to&lt;br /&gt; * Window - Preferences - PHPeclipse - PHP - Code Templates&lt;br /&gt; */&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;meta http-equiv="Content-Language" content="en" /&gt;&lt;br /&gt;&lt;meta name="GENERATOR" content="PHPEclipse 1.0" /&gt;&lt;br /&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312" /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;link href="dojo/src/widget/templates/HtmlSlideShow.css" rel="stylesheet" type="text/css" /&gt;&lt;br /&gt;&lt;script type="text/javascript" src="dojo/dojo.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;	&lt;script type="text/javascript" src="windows/javascripts/prototype.js"&gt; &lt;/script&gt; &lt;br /&gt;	&lt;script type="text/javascript" src="windows/javascripts/effects.js"&gt; &lt;/script&gt;&lt;br /&gt;	&lt;script type="text/javascript" src="windows/javascripts/window.js"&gt; &lt;/script&gt;&lt;br /&gt;	&lt;script type="text/javascript" src="windows/javascripts/debug.js"&gt; &lt;/script&gt;&lt;br /&gt;	&lt;link href="windows/themes/default.css" rel="stylesheet" type="text/css" &gt;	 &lt;/link&gt;&lt;br /&gt;	&lt;link href="windows/themes/theme1.css" rel="stylesheet" type="text/css" &gt;	 &lt;/link&gt;&lt;br /&gt;	&lt;link href="winodws/themes/alert.css" rel="stylesheet" type="text/css" &gt;	 &lt;/link&gt;&lt;br /&gt;	&lt;title&gt;Sample Windows&lt;/title&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;   //dojo.require("dojo.widget.Editor");&lt;br /&gt;    //dojo.require("dojo.widget.SlideShow");&lt;br /&gt;	//doji.require("dojo.event.*");&lt;br /&gt;     &lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;body bgcolor="#FFFFFF" text="#000000" link="#FF9966" vlink="#FF9966" alink="#FFCC99"&gt;&lt;br /&gt;&lt;br /&gt;	&lt;a href="javascript:openModalDialog()"&gt;Click here to open a modal window&lt;/a&gt;&lt;br /&gt;	&lt;br/&gt;&lt;br /&gt;	&lt;script&gt;&lt;br /&gt;	var index= 0;&lt;br /&gt;    var contentWin = null;&lt;br /&gt;		function openContentWindow() {&lt;br /&gt;		if (contentWin != null) {&lt;br /&gt;			Dialog.alert("Close the window 'Test' before opening it again!"); &lt;br /&gt;		}&lt;br /&gt;		else {&lt;br /&gt;			contentWin = new Window('content_win', {title: "Test ",top:100, left:100, resizable: false})&lt;br /&gt;			contentWin.setContent('test_content', true)&lt;br /&gt;			contentWin.toFront();&lt;br /&gt;			contentWin.setDestroyOnClose();&lt;br /&gt;			contentWin.show();	&lt;br /&gt;		}		&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;		function openModalDialog() {&lt;br /&gt;		var win = new Window('modal' + index, {title: "&#230;&#732;&#8220;&#231;&#8482;&#187;&#231;&#189;&#8216;",top:100, left:100,  width:300, height:200, zIndex:150, opacity:50, resizable: true,hideEffect: Effect.Grow})&lt;br /&gt;		win.getContent().innerHTML = "&amp;nbsp;&amp;nbsp;&lt;a href='http://www.edeng.cn'&gt;edeng&lt;/a&gt;&lt;br /&gt;&lt;input type='submit' value='&#230;??&#228;&#186;&#164;'&gt;"&lt;br /&gt;		win.show(true);	&lt;br /&gt;		index++;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	win = new Window('dialog1', {className: "dialog",  width:300, height:400, zIndex: 100, resizable: true, title: "Title", hideEffect: Effect.SwitchOff})&lt;br /&gt;	win.getContent().innerHTML= "&lt;div style='padding:10px'&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit, set eiusmod tempor incidunt et labore et dolore magna aliquam. Ut enim ad minim veniam, quis nostrud exerc. Irure dolor in reprehend incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse molestaie cillum. Tia non ob ea soluad incom dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda et tam. \&lt;br /&gt;	At vver eos et accusam dignissum qui blandit est praesent. Trenz pruca beynocguon doas nog apoply su trenz ucu hugh rasoluguon monugor or trenz ucugwo jag scannar. Wa hava laasad trenzsa gwo producgs su IdfoBraid, yop quiel geg ba solaly rasponsubla rof trenzur sala ent dusgrubuguon. Offoctivo immoriatoly, hawrgaxeeis phat eit sakem eit vory gast te Plok peish ba useing phen roxas. Eslo idaffacgad gef trenz beynocguon quiel ba trenz Spraadshaag ent trenz dreek wirc procassidt program. Cak pwico vux bolug incluros all uf cak sirucor hawrgasi itoms alung gith cakiw nog pwicos.\&lt;br /&gt;	Lor sum amet, commy nulputat. Duipit lum ipisl eros dolortionsed tin hent aliquis illam volor in ea feum in ut adipsustrud elent ulluptat. Duisl ullan ex et am vulputem augiam doloreet amet enibh eui te dipit acillutat acilis amet, suscil er iuscilla con utat, quisis eu feugait ad dolore commy nullam iuscilisl iureril ilisl del ut pratuer iliquis acipissit accum quis nulluptat. Dui bla faccumsan velis auguero con henis duismolor sumsandrem quat vulluptat alit er iniamcore exeriure vero core te dit ut nulla feummolore commod dipis augiamcommod tem ese dolestrud do odo odiamco eetummy nis aliquamcommy nonse eu feugue del eugiamconsed ming estrud magnis exero eumsandio enisim del dio od tat.sumsan et pratum velit ing etue te consequis alis nullan et, quis am iusci bla feummy.&lt;/div&gt;"&lt;br /&gt;	win.showCenter();&lt;br /&gt;	&lt;/script&gt;&lt;br /&gt;&lt;div dojoType="Editor" items="textGroup;|;listGroup;|;colorGroup;|;blockGroup;|;commandGroup;"&gt;&lt;br /&gt;    some contentfsdfsdfsdfsdfsdfsdfsd  dddd&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;img dojoType="SlideShow" &lt;br /&gt;    imgUrlBase="dojo/src/pic/"&lt;br /&gt;    imgUrls="2.jpg;3.jpg" &lt;br /&gt;    transitionInterval="700"&lt;br /&gt;    delay="1000"&lt;br /&gt;    imgWidth="400"&lt;br /&gt;    imgHeight="300"&lt;br /&gt;    width="400"&lt;br /&gt;    height="300"&lt;br /&gt;    src="http://dojotoolkit.org/path/to/dojo/tests/widget/images/1.jpg" /&gt;&lt;p&gt;&lt;br /&gt;    &lt;?php echo "ddd" ?&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 08 Apr 2006 10:04:44 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1863</guid>
      <author>vista8 (joe)</author>
    </item>
    <item>
      <title>good website</title>
      <link>http://snippets.dzone.com/posts/show/1862</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;http://blogus.xilinus.com/pages/javawin&lt;br /&gt;http://bennolan.com/behaviour/&lt;br /&gt;http://prototype.conio.net/&lt;br /&gt;http://ajaxpatterns.org/PHP_Ajax_Frameworks&lt;br /&gt;http://www.ajaxload.info/&lt;br /&gt;http://www.dragon-labs.com/articles/utm/&lt;br /&gt;http://www.snook.ca/archives/000531.php&lt;br /&gt;http://www.netlobo.com/div_hiding.html&lt;br /&gt;http://www.roundcube.net/&lt;br /&gt;http://24ways.org/&lt;br /&gt;http://www.designologue.com/v3/&lt;br /&gt;http://www.musicstrands.com/&lt;br /&gt;http://www.soundclick.com/&lt;br /&gt;http://www.drweb.de/programmierung/ajax.shtml&lt;br /&gt;http://www.modernmethod.com/sajax/&lt;br /&gt;&lt;br /&gt; http://css.maxdesign.com.au/&lt;br /&gt;http://www.iconbuffet.com/&lt;br /&gt;http://www.mainada.net/comics/edit_strip/new&lt;br /&gt;&lt;br /&gt;http://bennolan.com/behaviour/&lt;br /&gt;&lt;br /&gt;http://lab.rails2u.com/bgmaker/&lt;br /&gt;&#230;&#732;&#8220;&#231;&#8482;&#187;&#231;&#189;&#8216;www.edeng.cn &#239;&#188;&#338;&#230;&#177;&#8218;&#232;?&#338;&#230;&#8249;&#8250;&#232;?&#732;&#227;&#8364;?&#230;&#710;&#191;&#229;&#177;&#8249;&#229;&#8225;&#186;&#231;&#167;&#376;&#227;&#8364;?&#230;&#8240;&#190;&#230;&#339;&#8249;&#229;?&#8249;&#228;&#184;&#8364;&#231;&#189;&#8216;&#230;&#8240;&#8220;&#229;&#176;&#189;&#239;&#188;?&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 07 Apr 2006 20:19:12 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1862</guid>
      <author>vista8 (joe)</author>
    </item>
    <item>
      <title>test</title>
      <link>http://snippets.dzone.com/posts/show/1847</link>
      <description>// lalala&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;embed src="http://sy8.haoting.com:3193/16z/0/givemefivelyc/1/1.wma"width="450" height="45"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="" width=450&gt;&lt;br /&gt;&lt;a href='http://www.edeng.cn/code/bin/request/redirforsession.php/**http://sy8.haoting.com:3193/16z/0/givemefivelyc/1/1.wma  '&gt;&lt;font color=#ff6600&gt;&#28857;&#20987;&#19979;&#36733;&lt;/font&gt;&lt;/a&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 05 Apr 2006 15:26:09 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1847</guid>
      <author>vista8 (joe)</author>
    </item>
  </channel>
</rss>
