Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class tes extends CI_Controller {
- var $replace = array(
- 'r' => 12,
- 'R' => 12,
- 's' => 5,
- 'S' => 5,
- 'a' => 4,
- 'A' => 4,
- 'e' => 3,
- 'E' => 3,
- 'i' => 1,
- 'I' => 1,
- 'o' => 0,
- 'O' => 0,
- );
- public function index(){}
- public function alay($str)
- {
- $str = urldecode($str);
- $arr = explode(' ', $str);
- foreach ($arr as $i=>$a)
- {
- if (!is_numeric($a))
- {
- $arr[$i] = str_replace(array_keys($this->replace), $this->replace, $arr[$i]);
- }
- }
- return implode(' ', $arr);
- }
- public function dealay($str)
- {
- $str = urldecode($str);
- $arr = explode(' ', $str);
- foreach ($arr as $i=>$a)
- {
- if (!is_numeric($a) && strtoupper($a) != $a )
- {
- $arr[$i] = str_replace($this->replace, array_keys($this->replace), $arr[$i]);
- }
- }
- return implode(' ', $arr);
- }
- public function auto($str)
- {
- $str = urldecode($str);
- $is_alay = false;
- $arr = explode(' ', $str);
- foreach ($arr as $a)
- {
- if (preg_match('/[A-Za-z]+[0-9]+/', $a) && strlen($a) > 2) $is_alay = true;
- }
- $str = implode(' ', $arr);
- if ($is_alay) $str = $this->dealay($str);
- else $str = $this->alay($str);
- echo $str;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement