Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.19 KB | None | 0 0
  1. <?php
  2. /**
  3.  *
  4.  *
  5.  */
  6.  
  7. //@#$ |
  8. @defined("LOCK", 1) or ('Voc&ecirc; n&atilde;o tem permiss&atilde;o para acessar esse arquivo.');
  9.  
  10. //@#$ |
  11. class GeradorHacker extends html_erro
  12. {
  13.     public $Estilo;
  14.     public $Especial;
  15.     private $Texto;
  16.     public $ContarCaracteres;
  17.     public $erro = null;
  18.    
  19.     public function __construct($Estilo, $Especial, $Texto, $ContarCaracteres)
  20.     {
  21.         $this->Estilo = $Estilo;
  22.         $this->Especial = $Especial;
  23.         $this->Texto = $Texto;
  24.         $this->ContarCaracteres = $ContarCaracteres;
  25.         $this->erro = $erro;
  26.        
  27.        
  28.         //@#$ | Chamar funções...
  29.         $this->ValidarDados();
  30.         $this->TratarDados();
  31.         $this->EscritaHacker();
  32.         $this->AdicionarEspecial();
  33.         $this->ImprimirTexto();
  34.        
  35.        
  36.     }
  37.    
  38.     public function ValidarDados()
  39.     {
  40.       //@#$ | validando estilo...
  41.       if ( empty($this->Estilo) )
  42.           new html_erro('Você não definiu o estilo em que o texto será gerado. Somente dois estilos s&atilde;o permitidos: <b>simples</b> ou <b>ultra</b>. Escolha o seu e gere seu texto!');
  43.      
  44.      
  45.       //@#$ | validando contagem de caractéres...
  46.       if ( empty($this->ContarCaracteres) )
  47.           new html_erro('Você não decidiu... Se vai contar os caract&eacute;res: <b>sim</b> ou <b>n&atilde;o</b>?');
  48.      
  49.      
  50.       //@#$ | validando texto...
  51.       if ( empty($this->Texto) )
  52.           new html_erro('Você não digitou o <strong>texto</strong> a ser gerado, digite o texto.');
  53.  
  54.     } // $this->ValidarDados();
  55.    
  56.    
  57.     private function TratarDados()
  58.     {
  59.       //@#$ | retira possiveis espaços antes e depois do texto.
  60.       //@#$ | retira tags HTML e/ou PHP, do texto...
  61.       //@#$ | transforma o texto inteiro em letras maiusculas.
  62.       $this->Texto = trim($this->Texto);
  63.       $this->Texto = strip_tags($this->Texto);
  64.       $this->Texto = strtoupper($this->Texto);
  65.      
  66.       //@#$ | retira possiveis espaços antes e depois do $this->estilo.
  67.       //@#$ | retira tags HTML e/ou PHP, do $this->estilo...
  68.       $this->Estilo = trim($this->Estilo);
  69.       $this->Estilo = strip_tags($this->Estilo);
  70.     } // $this->TratarDados();
  71.    
  72.    
  73.     private function NumeroCaracteres()
  74.     {
  75.         //@#$ | retorna o numero de caracteres de uma string...
  76.         $this->Caracteres = strlen($this->Texto);
  77.        
  78.         switch ( $this->ContarCaracteres ) :
  79.        
  80.             case 'sim':
  81.                 //@#$ | Exibe o numero de caracteres após texto gerado....
  82.                 $this->TextoFinal .= " [ O texto gerado, cont&eacute;m: ".$this->Caracteres." caract&eacute;res. ] ";
  83.             break;
  84.            
  85.             case 'nao':
  86.                 //apenas continua o código...
  87.             break;
  88.            
  89.             default:
  90.                 new html_erro('Você não decidiu... Se vai contar os caract&eacute;res: <b>sim</b> ou <b>n&atilde;o</b>?');
  91.                
  92.         endswitch;
  93.     } // $this->NumeroCaracteres();
  94.    
  95.    
  96.     private function EscritaHacker()
  97.     {
  98.         switch ( $this->Estilo ) :
  99.          
  100.             case 'simples' :
  101.                 $this->search = array('A', 'E', 'G', 'I', 'O', 'S', 'T');
  102.                 $this->replace = array('4', '3', '6', '1', '0', '5', '7');
  103.                
  104.                 $this->TextoTemp = str_replace($this->search, $this->replace, $this->Texto);
  105.            
  106.             break;
  107.            
  108.             case 'ultra' :
  109.              
  110.                 $this->search = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'Y', 'X', 'Z');
  111.                 $this->replace = array('@', '|}', '(', '[)', '3', '|=', '6', '|-|', '1', 'J', '|<', '|', '|\/|', '|\|', '0', '|*', 'q', '|2', '$', '+', '|_|', '\/', '\X/', '`/', '><', 'Z');
  112.                
  113.                 $this->TextoTemp = str_replace($this->search, $this->replace, $this->Texto);
  114.             break;
  115.            
  116.             default:
  117.                 new html_erro('Você definiu um estilo não suportado pela APi. Somente dois estilos s&atilde;o suportados: <b>simples</b> ou <b>ultra</b>.');
  118.            
  119.         endswitch;
  120.     } // $this->EscritaHacker();
  121.    
  122.    
  123.     private function AdicionarEspecial()
  124.     {
  125.       $this->Especial = explode(':', $this->Especial);
  126.              
  127.         if ( !empty($this->Especial['1']) ) :
  128.           $this->TextoFinal .= $this->Especial['0'];
  129.           $this->TextoFinal .= " " . $this->TextoTemp . " ";
  130.           $this->TextoFinal .= $this->Especial['1'];
  131.              
  132.           $this->NumeroCaracteres();               
  133.         else:
  134.           $this->TextoFinal = $this->TextoTemp;
  135.          
  136.           $this->NumeroCaracteres();   
  137.         endif;
  138.     } // $this->AdicionarEspecial();
  139.    
  140.    
  141.     private function ImprimirTexto()
  142.     {
  143.       print($this->TextoFinal);
  144.     } // $this->ImprimirTexto();
  145.    
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement