Esempio n. 1
0
 /** \Zend\Filter\PregReplace() */
 public function index14Action()
 {
     $filter = new \Zend\Filter\PregReplace();
     $input = 'Zend Framework 2 <> 1232132___1312321';
     $filter->setPattern('#[0-9]#');
     $filter->setReplacement('X');
     $output = $filter->filter($input);
     echo "<h3>" . $input . "</h3>";
     echo "<h3>" . $output . "</h3>";
     return false;
 }
Esempio n. 2
0
 public function ajaxUserLoginAction()
 {
     if ($this->getRequest()->isPost()) {
         $pwdEncrypt = new \Zend\Crypt\Password\Apache();
         $pwdEncrypt->setFormat('sha1');
         $filterReplace = new \Zend\Filter\PregReplace(array('pattern' => '/{SHA}/', 'replacement' => ''));
         $pwdEncryptResult = $filterReplace->filter($pwdEncrypt->create($this->getRequest()->getPost('password')));
         $authService = $this->cUser->setUsername($this->getRequest()->getPost('username'))->setPassword($pwdEncryptResult)->authenticate();
         if ($authService['status'] === 'success') {
             echo json_encode(array('status' => 'success', 'code' => $authService['code']));
         } else {
             echo json_encode(array('status' => 'failure', 'code' => $authService['code']));
         }
     } else {
         echo json_encode(array('status' => 'failure', 'code' => '401'));
     }
     exit;
 }
Esempio n. 3
0
 public function index13Action()
 {
     echo "<h3 style='color:red;font-weight:bold'>" . __METHOD__ . "</h3>";
     $filter = new \Zend\Filter\PregReplace(array("pattern" => "#[0-9]#", "replacement" => "x"));
     $input = "trongle123";
     $output = $filter->filter($input);
     echo "<h2>Input: {$input}</h2><br>";
     echo "<h2>Output : {$output}</h2>";
     return false;
 }
Esempio n. 4
0
 function __construct()
 {
     parent::__construct('/\\W+/', '');
 }