Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Khaled Al-Shamaa  >  ArCharsetC  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ArCharsetC
Convert Arabic texts between different encodings
Author: By
Last change: I add two new methods to convert Arabic text represents as HTML entities (for examples ض instead of Dad Arabic character) into UTF-8 (method name is: html2utf) and Windows-1256 (method name is: html2win).
Date: 7 years ago
Size: 3,474 bytes
 

Contents

Class file image Download
<?php
$test 
file('test2.html');
$text implode("<br>"$test);

if(isset(
$_GET['charset'])){
    
$charset $_GET['charset'];
}else{
    
$charset 'windows-1256';
}

@
ini_set('zend.ze1_compatibility_mode''1');

include(
'ArCharsetC.class.php');
$arc = new ArCharsetC();

/*
Available methods for this class include:
>> win2iso: to convert Windows-1256 character set into ISO 8859-6 character set
>> win2utf: to convert Windows-1256 character set into UTF-8 character set
>> iso2win: to convert ISO 8859-6 character set into Windows-1256 character set
>> iso2utf: to convert ISO 8859-6 character set into UTF-8 character set
>> utf2win: to convert UTF-8 character set into Windows-1256 character set
>> utf2iso: to convert UTF-8 character set into ISO 8859-6 character set
*/

switch($charset){
    case 
'windows-1256':
        
$text $text;
        break;
    case 
'iso-8859-6':
        
$text $arc->win2iso($text);
        break;
    case 
'utf-8':
        
$text $arc->win2utf($text);
        break;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset?>">

<meta name="Subject" content="Arabic Character Set Converter" />
<meta name="Description" content="Arabic Character Set Converter" />
<meta name="Classification" content="PHP and Arabic Language" />
<meta name="Keywords" content="Charset, Converter, UTF-8, Windows-1256, PHP, Arabic, Language, Development, Implementation, Open Source, Free, GPL, Classes, Code" />
<meta name="Language" content="English, Arabic" />
<meta name="Author" content="Khaled Al-Shamaa" />
<meta name="Copyright" content="Khaled Al-Shamaa" />
<meta name="Designer" content="Khaled Al-Shamaa" />
<meta name="Publisher" content="Khaled Al-Shamaa" />
<meta name="Distribution" content="Global" />
<meta name="Robots" content="INDEX,FOLLOW" />
<meta name="City" content="Aleppo" />
<meta name="Country" content="Syria" />

<link rel="shortcut icon" href="../favicon.ico" />
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
<title>Arabic Character Set Converter</title>
</head>

<body>

<center>
<div style="width: 80%; position:absolute; left:10%; top:0%; z-index:1">
<br />
<div class="tabArea" align="center">
  <a class="tab" href="example.php">Example</a>
  <a class="tab" href="about.html">About</a>
  <a class="tab" href="http://www.ar-php.com">Homepage</a>
</div>

<div class="Paragraph" dir="rtl">

<a href="example.php?charset=windows-1256">Windows-1256</a> |
<a href="example.php?charset=iso-8859-6">ISO 8859-6</a> |
<a href="example.php?charset=utf-8">UTF-8</a><hr>
<font face="Tahoma" size="2">
<?php echo $text?>
</font>

</div>
<table border="0" cellspacing="0" align="left">
  <tr>
    <td bgcolor="#448800">&nbsp;&nbsp;</td>
    <td bgcolor="#66aa00">&nbsp;&nbsp;</td>
    <td bgcolor="#77bb00">&nbsp;&nbsp;</td>
    <td bgcolor="#aadd00">&nbsp;&nbsp;</td>
    <td bgcolor="#eeff66">&nbsp;&nbsp;</td>
  </tr>
</table>
</div>
</center>
          <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
          </script>
          <script type="text/javascript">
          _uacct = "UA-1268287-1";
          urchinTracker();
          </script>
</body>
</html>