<?
//license copy: Gilbert Cheung (hide@address.com) © 2005
/*
- author: A4 [hide@address.com]
- filename: cutl.php
- date: 2005
- what for: generates phonetic combinations of a given word
*/
//merge POST and GET vars 2geza
if(!isset($attributes) || !is_array($attributes))
{
$attributes = array();
$attributes = array_merge($_GET,$_POST);
}
$arrTexts = explode("\n", $attributes['text']);
$complexAlgorithm = isset( $attributes['multi'] );
//extensions
$arrExtensions = array("No extention", ".com", ".net", ".org", ".info", ".us", ".biz");
//form was submitted
if($attributes['submit']!="")
{
include 'phonetic.class.php';
$ph = new Phonetic();
$arrVariants = $ph->generate( $arrTexts, $complexAlgorithm );
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Phoentic Generator - works with domains too!</title>
</head>
<body>
<fieldset style="padding-left: 10;">
<legend>Settings</legend>
<form method="post" action="<?=$PHP_SELF?>">
Text:
<textarea rows=5 cols=30 name="text"><?=( $attributes['text'] ? $attributes['text'] : 'Microsoft
Nokia')?></textarea>
<select name="ext">
<?
for($i=0; $i<sizeof($arrExtensions); $i++)
echo "<option value='".$i."' ".($attributes['ext']==$i?"selected":"").">".$arrExtensions[$i];
?>
</select><br><br>
<label for="multi" title="gives more results, but is slower"><input type="checkbox" name="multi" id="multi" <?=( $complexAlgorithm ? 'checked="checked"' : '' )?>>Complex
Algorithm</label><br><br>
<input type="submit" name="submit" id="submit" value="submit">
</form>
</fieldset>
<?
//output collected variants as HTML list
if(!empty($arrVariants))
{
if($attributes['ext']>0)
while(list($id, $data) = each($arrVariants))
{
while(list($key, $val) = each($data))
echo "<a href='http://".$val.$arrExtensions[$attributes['ext']]."'>" .$val.$arrExtensions[$attributes['ext']] . "</a><br>";
echo "<hr>";
}
else
while(list($id, $data) = each($arrVariants))
{
echo "" . implode("<br>", $arrVariants[$id]) . "";
echo "<hr>";
}
}
?>
</body>
</html>