PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of MC Breit   RFC 1766   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: A simple test/demo of the class
Class: RFC 1766
Map idiom tag to its names as defined in RFC 1766
Author: By
Last change:
Date: 18 years ago
Size: 2,708 bytes
 

Contents

Class file image Download
<?php
/***************************************************************************
 * rfc1766 Test Script
 * -------------------
 * begin : Wednesday, Dec 29, 2004 - 23:50
 * copyright : (C) 2004 MC Breit
 * email : support@mcb.cc - MCB.CC - Free and Open Sources
 * last modified : 30/12/04 - 00:56 - MC Breit
 * version : 1.0.0
 *
 ***************************************************************************/
 
/***************************************************************************
 *
 * 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.
 *
 ***************************************************************************/

//
// Include the main class..
//

include('./rfc1766.class.php');

//
// Let's do some testings!
//

//Create a new object of rfc1766
$rfc1766 = &new rfc1766();


print
'<pre>'."\n";
//Make some testings be resolving the human readable description of various languages..
print '---------------- Mapping Lang-Tags to human readable text ----------------'."\n";
print
'i-klingon: '.$rfc1766->get_name('i-klingon')."\n";
print
'en-US: '.$rfc1766->get_name('en-US')."\n";
print
'fr: '.$rfc1766->get_name('fr')."\n";
print
'az-Cyrl: '.$rfc1766->get_name('az-Cyrl')."\n";
print
'x-borg: '.$rfc1766->get_name('x-borg')."\n";
print
'en-GB-oed: '.$rfc1766->get_name('en-GB-oed')."\n";
print
'zh-xIaNg: '.$rfc1766->get_name('zh-xIaNg')."\n";
print
'de-DE-Arab: '.$rfc1766->get_name('de-DE-Arab')."\n";
print
'--------------------------------------------------------------------------'."\n";
print
"\n";
//Check some language tags for validation..
print '------------------------ Validation of Lang-Tags -------------------------'."\n";
print
'i-klingon: '.( ( $rfc1766->is_valid_tag('i-klingon') ) ? 'Valid' : 'Not valid' )."\n";
print
'x-tolonglang: '.( ( $rfc1766->is_valid_tag('x-tolonglang') ) ? 'Valid' : 'Not valid' )."\n";
print
'en-GB-US-cyrl: '.( ( $rfc1766->is_valid_tag('de-GB-US-Cyrl') ) ? 'Valid' : 'Not valid' )."\n";
print
'i-undef: '.( ( $rfc1766->is_valid_tag('i-undef') ) ? 'Valid' : 'Not valid' )."\n";
print
'x-foo-bar-baz: '.( ( $rfc1766->is_valid_tag('x-foo-bar-baz') ) ? 'Valid' : 'Not valid' )."\n";
print
'--------------------------------------------------------------------------'."\n";

print
'</pre>';

//
// Thats it folks!
//
?>