Jump to content


superdanyboy

Member Since 09/02/2007
Offline Last Active 03/08/2010, 21:07
-----

Topics I've Started

Convert Text

03/08/2010, 21:07

CRIEI UM SCRIPT PARA CONVERTER TEXTOS DE MAÍSCULAS EM MINÚSCULAS SEM ACENTOS EM PHP E VICE E VERSA.

QUEM TIVER INTERESSE ACESSE O LINK.

http://www.alvesbarb...nvert-text-php/

index.php
<!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=iso-8859-1" />
<title>Convert Text PHP</title>
<style type="text/css">
<!--
.cabecalho {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.nome {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style>
</head>

<body>
<br />
<br />
<table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top" class="cabecalho">&nbsp;</td>
  </tr>
  <tr>
    <td align="center" valign="top" class="cabecalho">CONVERT TEXT PHP 1.0.0</td>
  </tr>
  <tr>
    <td align="center" valign="top" class="cabecalho">03-agosto-2010</td>
  </tr>
  <tr>
    <td align="center" valign="top" class="cabecalho">&nbsp;</td>
  </tr>
  <tr>
    <td align="center" valign="top"><form action="Convert-Text.php" method="post">
      <span class="nome">PALAVRA ORIGINAL</span><br />
      <table width="300" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="center" valign="top"><input name="palavra" type="text" id="palavra" value="LIQUIDA&Ccedil;&Atilde;O DE LUXO" size="60" maxlength="200" /></td>
        </tr>
        <tr>
          <td align="center" valign="top" class="nome">Juntar Palavras?</td>
        </tr>
        <tr>
          <td align="center" valign="top" class="nome"><label>
            <input type="radio" name="juntar" id="radio3" value="sim" />
            sim
          </label>
            <input name="juntar" type="radio" id="radio4" value="nao" checked="checked" />
            n&atilde;o</td>
        </tr>
        <tr>
          <td align="center" valign="top" class="nome">Separador <br />
            (Digite o Separador Desejado &quot;-&quot;, &quot; &quot;, &quot;_&quot; )</td>
        </tr>
        <tr>
          <td align="center" valign="top"><label>
            <input name="separador" type="text" id="separador" value="-" size="4" maxlength="6" />
          </label></td>
        </tr>
        <tr>
          <td align="center" valign="top" class="nome">Converte Para</td>
        </tr>
        <tr>
          <td align="center" valign="top"><label>
              <span class="nome">
            <input type="radio" name="letra" id="radio" value="AAA" />
            AAA            </span></label>            
            <span class="nome">
            <input name="letra" type="radio" id="radio2" value="aaa" checked="checked" />
            aaa</span></td>
        </tr>
      </table>
      <br />
      <input name="Converter" type="submit" id="Converter" value="Converter" />
    </form></td>
  </tr>
  <tr>
    <td align="center" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td align="center" valign="top" class="nome"><a href="convert-text-php.zip" target="_blank">Baixar Script</a></td>
  </tr>
  <tr>
    <td align="center" valign="top" class="nome"><p>LEIA-ME (GR&Aacute;TIS)</p>
      <p>COPIE OU DIGITE O TEXTO E OBTENHA ELE PRA O FORMATO WEB.</p>
      <p>IDEAL PARA RENOMEAR ARQUIVOS PARA INTERNET.</p>
      <p>POR EXEMPLO COLOQUE:<br />
&quot;MINHA P&Aacute;GINA WEB.HTML&quot;</p>
      <p>E OBTER&Aacute; A SA&Iacute;DA <br />
      &quot;minha-pagina-web.html&quot;.</p>
      <p>AINDA COM A OP&Ccedil;&Atilde;O DE SEPARADOR.</p>
      <p>COMO O PROGRAMA TAMB&Eacute;M &Eacute; POSS&Iacute;VEL FAZER O INVERSO.<br />
      </p>
    <p>www.alvesbarbosa.com/PROGRAMAS-PHP/convert-text-php</p></td>
  </tr>
</table>
</body>
</html>

Convert-Text.php

<!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=iso-8859-1" />
<title>Convert Text PHP</title>
</head>
<body>
<?php
$palavra = $_POST["palavra"];
$separador = $_POST["separador"];
$letra = $_POST["letra"];
$juntar = $_POST["juntar"];

function RemoveAcentos($str, $enc = "iso-8859-1"){

$acentos = array(
'A' => '/&Agrave;|&Aacute;|&Acirc;|&Atilde;|&Auml;|&Aring;|À|Á|Â|Ã|Ä|Å|Æ /',
'a' => '/&agrave;|&aacute;|&acirc;|&atilde;|&auml;|&aring;|à|á|â|ã|ä|å|æ/',
'C' => '/&Ccedil;|Ç /',
'c' => '/&ccedil;|ç /',
'E' => '/&Egrave;|&Eacute;|&Ecirc;|&Euml;|È|É|Ê|Ë/',
'e' => '/&egrave;|&eacute;|&ecirc;|&euml;|è|é|ê|ë /',
'I' => '/&Igrave;|&Iacute;|&Icirc;|&Iuml;|Ì|Í|Î|Ï/',
'i' => '/&igrave;|&iacute;|&icirc;|&iuml;|ì|í|î|ï /',
'N' => '/&Ntilde;|Ñ/',
'n' => '/&ntilde;|ñ/',
'O' => '/&Ograve;|&Oacute;|&Ocirc;|&Otilde;|&Ouml;|Ò |Ó|Ô|Õ|Ö|×|Ø/',
'o' => '/&ograve;|&oacute;|&ocirc;|&otilde;|&ouml;|ð|ò|ó|ô|õ|ö|ø /',
'U' => '/&Ugrave;|&Uacute;|&Ucirc;|&Uuml;/',
'u' => '/&ugrave;|&uacute;|&ucirc;|&uuml;|Ù|Ú|Û|Ü /',
'Y' => '/&Yacute;|Ý/',
'y' => '/&yacute;|&yuml;|ý/',
'a.' => '/&ordf;|ª/',
'o.' => '/&ordm;|º/'
);

   return preg_replace($acentos,
                       array_keys($acentos),
                       htmlentities($str,ENT_NOQUOTES, $enc));
}

$Min1 = RemoveAcentos("$palavra");

//MAIÚSCULAS E MINÚSCULAS

if($letra == "aaa") {

$Min2 = strtolower($Min1); }

if($letra == "AAA") {

$Min2 = strtoupper($Min1); }

//---------------------------------------
//SEPARADOR

if(($juntar == "nao") and empty($separador) ){
$Min3 = str_replace(" ","&nbsp;","$Min2"); }

if(($juntar == "sim") and !empty($separador)) {
	unset($separador);
	$Min3 = str_replace(" ","$separador","$Min2"); }
	
if(($juntar == "sim") and empty($separador) ) {
	unset($separador);
	$Min3 = str_replace(" ","$separador","$Min2"); }
	
if(($juntar == "nao") and !empty($separador) ){
$Min3 = str_replace(" ","$separador","$Min2"); }

//--------------------------------------------------------
	
	
	

echo "$Min3";



?>
</body>
</html>

IPB Skin By Virteq