public function run() { $this->input = filter_input(INPUT_POST, 'english', FILTER_SANITIZE_FULL_SPECIAL_CHARS); if (isset($this->input)) { $lexer = new Lexer($this->input); $tokens = $lexer->run(); $translator = new Translator($tokens); $result = $translator->run(); if ($this->isAjax()) { $this->sendPayload($result); } } }
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); require_once 'abstract_translator.php'; class Translator extends AbstractTranslator { protected function translate_request($request) { $request = json_decode($request, true); var_dump($request); $formatted_request = array(); $formatted_request['ssn'] = implode('', explode('-', $request['ssn'])); $formatted_request['creditScore'] = $request['credit_score']; $formatted_request['loanAmount'] = $request['amount']; $formatted_request['loanDuration'] = $request['duration']; var_dump($formatted_request); return json_encode($formatted_request); } } $translator_params = array('host' => 'localhost', 'port' => '5672', 'username' => 'test', 'password' => 'test', 'routing_key' => '22222222'); $bank_params = array('host' => 'localhost', 'port' => '5672', 'username' => 'test', 'password' => 'test', 'exchange' => 'bank_not_nordea', 'reply_to' => 'vongrad_not_nordea'); $translator = new Translator($translator_params, $bank_params); $translator->run();
<table> <tr> <th>Directory</th> <td><input name="newdir"></td> </tr> <tr> <th>Language</th> <td><input name='language'></td> </tr> <tr> <th>Author</th> <td><input name='author'></td> </tr> <tr> <th>URL</th> <td><input name='url'></td> </tr> </table> <input type='submit' name='save' value='Submit'> <input type='reset'> </form> <?php } if (!defined("EMBEDDED")) { SB_Page::foot(); } } } $tr = new Translator(); $tr->run();