Пример #1
0
<?php

// encoding: utf-8
$o = new weeXHTMLEncoder();
// weeXHTMLEncoder::encode
$this->isEqual('win', $o->encode('win'), _WT('weeXHTMLEncoder::encode should return its argument untouched if it does not contain any special character.'));
$this->isEqual("Time to say 'night.", $o->encode("Time to say 'night."), _WT("weeXHTMLEncoder::encode should return any single quote character untouched."));
$this->isEqual('&quot;&gt;_&gt;&quot; &amp; &quot;&lt;_&lt;&quot; &amp; &quot;è_é&quot;', $o->encode('">_>" & "<_<" & "è_é"'), _WT('weeXHTMLEncoder::encode should return the expected encoded value.'));
$this->isEqual('東方妖々夢', $o->encode('東方妖々夢'), _WT('weeXHTMLEncoder::encode should not encode Unicode characters.'));
// weeXHTMLEncoder::decode
$this->isEqual('win', $o->decode('win'), _WT('weeXHTMLEncoder::decode should return its argument untouched if it does not contain any XHTML entity.'));
$this->isEqual('">_>" & "<_<" & "&egrave;_&eacute;"', $o->decode('&quot;&gt;_&gt;&quot; &amp; &quot;&lt;_&lt;&quot; &amp; &quot;&egrave;_&eacute;&quot;'), _WT('weeXHTMLEncoder::decode should return the expected decoded value.'));
Пример #2
0
 /**
 	Delete all buffers and print the error page.
 	If no page was defined using weeException::setErrorPage, the default error page is shown.
 
 	@param $aDebug An array containing debugging information about the error or the exception.
 */
 public static function printErrorPage($aDebug)
 {
     while (ob_get_level()) {
         ob_end_clean();
     }
     // Try to set headers to sane values
     if (!headers_sent()) {
         header('Content-Type: text/html');
         header('Content-Disposition: inline');
         header('Content-Encoding: identity');
     }
     if (empty(self::$sErrorPagePath)) {
         self::$sErrorPagePath = ROOT_PATH . 'res/wee/error.htm';
     }
     // Encode the debug array for XHTML
     $oEncoder = new weeXHTMLEncoder();
     $aDebug = $oEncoder->encodeArray($aDebug);
     require self::$sErrorPagePath;
 }