Login   Register  
PHP Classes
elePHPant
Icontem

File: test_javascript_string_escaping.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Manuel Lemos  >  Forms generation and validation  >  test_javascript_string_escaping.php  >  Download  
File: test_javascript_string_escaping.php
Role: Unit test script
Content type: text/plain
Description: Test script to verify the generation of escaped Javascript strings
Class: Forms generation and validation
HTML forms generation and validation.
Author: By
Last change:
Date: 6 years ago
Size: 472 bytes
 

Contents

Class file image Download
<?php

/*
 * test_javascript_string_escaping.php
 *
 * @(#) $Id: test_javascript_string_escaping.php,v 1.1 2008/02/04 05:58:20 mlemos Exp $
 *
 */

    
require('forms.php');

    
$form = new form_class;
    
$strings = array(
        
'',
        
"\n",
        
"\r",
        
"\t",
        
'<',
        
'%',
        
'\'',
        
'\\',
        
chr(160),
        
"\n<",
        
"<%",
        
"<'",
        
"<\\",
        
"<\n",
        
"<\r",
        
"<\t",
        
' <',
    );
    
$t count($strings);
    for(
$s 0$s $t; ++$s)
        echo 
$form->EncodeJavascriptString($strings[$s]), "\n";
?>