@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | public function login(Request $request) |
22 | 22 | { |
23 | - session(['laralang.password' => Crypt::encrypt($request->input('password'))]); |
|
23 | + session([ 'laralang.password' => Crypt::encrypt($request->input('password')) ]); |
|
24 | 24 | if (Crypt::decrypt(session('laralang.password')) != config('laralang.default.password')) { |
25 | 25 | return redirect(Route('laralang::login')) |
26 | 26 | ->with('status', 'Invalid password'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('laralang_translations', function (Blueprint $table) { |
|
16 | + Schema::create('laralang_translations', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('translator'); |
19 | 19 | $table->string('string'); |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | if (config('laralang.default.routes')) { |
3 | - Route::group(['middleware' => 'web', 'as' => 'laralang::', 'prefix' => config('laralang.default.prefix'), 'namespace' => 'Aitor24\Laralang\Controllers'], function () { |
|
3 | + Route::group([ 'middleware' => 'web', 'as' => 'laralang::', 'prefix' => config('laralang.default.prefix'), 'namespace' => 'Aitor24\Laralang\Controllers' ], function() { |
|
4 | 4 | Route::get('/login', 'LaralangController@showLogin')->name('login'); |
5 | 5 | Route::post('/login', 'LaralangController@login'); |
6 | 6 | |
7 | - Route::group(['middleware' => 'laralang.middleware'], function () { |
|
8 | - Route::get('/', function () { |
|
7 | + Route::group([ 'middleware' => 'laralang.middleware' ], function() { |
|
8 | + Route::get('/', function() { |
|
9 | 9 | return redirect(Route('laralang::translations')); |
10 | 10 | })->name('home'); |
11 | 11 | Route::get('/translations', 'LaralangController@showTranslations')->name('translations'); |
12 | 12 | Route::post('/delete', 'LaralangController@deleteTranslation')->name('delete'); |
13 | 13 | Route::post('/edit', 'LaralangController@editTranslation'); |
14 | 14 | Route::get('/logout', 'LaralangController@logout')->name('logout'); |
15 | - Route::group(['middleware' => ['throttle:5000,1', 'bindings']], function () { |
|
15 | + Route::group([ 'middleware' => [ 'throttle:5000,1', 'bindings' ] ], function() { |
|
16 | 16 | Route::get('/api', 'LaralangController@api')->name('api'); |
17 | 17 | }); |
18 | 18 | }); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public static function trans($string) |
20 | 20 | { |
21 | 21 | $translator = config('laralang.default.translator'); |
22 | - if (!in_array(config('laralang.default.translator'), ['apertium', 'mymemory'])) { |
|
22 | + if (!in_array(config('laralang.default.translator'), [ 'apertium', 'mymemory' ])) { |
|
23 | 23 | return "<font style='color:red;'>Laralang doesn't support $translator translator. Check config</font>"; |
24 | 24 | } else { |
25 | 25 | if (config('laralang.default.translator') == 'mymemory') { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function languages() |
39 | 39 | { |
40 | - $locales = []; |
|
40 | + $locales = [ ]; |
|
41 | 41 | $translations = DB_Translation::distinct()->select('to_lang')->get(); |
42 | 42 | foreach ($translations as $object) { |
43 | 43 | array_push($locales, $object->to_lang); |
@@ -52,6 +52,6 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public static function allLanguages() |
54 | 54 | { |
55 | - return ['English' => 'en', 'Spanish' => 'es', 'Catalan' => 'ca', 'Portuguese' => 'pt', 'Chinese' => 'zh', 'Japanese' => 'ja', 'German' => 'de', 'French' => 'fr']; |
|
55 | + return [ 'English' => 'en', 'Spanish' => 'es', 'Catalan' => 'ca', 'Portuguese' => 'pt', 'Chinese' => 'zh', 'Japanese' => 'ja', 'German' => 'de', 'French' => 'fr' ]; |
|
56 | 56 | } |
57 | 57 | } |
@@ -117,7 +117,7 @@ |
||
117 | 117 | if ($this->debug === true) { |
118 | 118 | $this->translation = "<font style='color:#00CC00;'>Translation loaded from DB</font>"; |
119 | 119 | } else { |
120 | - $this->translation = ($existing[0]->translation); |
|
120 | + $this->translation = ($existing[ 0 ]->translation); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return true; |
@@ -19,19 +19,19 @@ |
||
19 | 19 | $urldata = file_get_contents("http://$host/get?q=$urlString&langpair=$this->from|$this->to"); |
20 | 20 | $data = json_decode($urldata, true); |
21 | 21 | |
22 | - if ($data['responseStatus'] != 200) { |
|
22 | + if ($data[ 'responseStatus' ] != 200) { |
|
23 | 23 | if ($this->debug == true) { |
24 | - if ($data['responseStatus'] == 403) { |
|
25 | - $details = ($data['responseDetails']); |
|
24 | + if ($data[ 'responseStatus' ] == 403) { |
|
25 | + $details = ($data[ 'responseDetails' ]); |
|
26 | 26 | } else { |
27 | - $details = $data['responseDetails']; |
|
27 | + $details = $data[ 'responseDetails' ]; |
|
28 | 28 | } |
29 | 29 | $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>'; |
30 | 30 | } |
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | - $this->translation = $data['responseData']['translatedText']; |
|
34 | + $this->translation = $data[ 'responseData' ][ 'translatedText' ]; |
|
35 | 35 | |
36 | 36 | $this->checkSave(); |
37 | 37 |
@@ -21,15 +21,15 @@ discard block |
||
21 | 21 | |
22 | 22 | // Checking response status |
23 | 23 | |
24 | - if ($data['responseStatus'] != 200) { |
|
24 | + if ($data[ 'responseStatus' ] != 200) { |
|
25 | 25 | if ($this->debug === true) { |
26 | - $this->translation = "<font style='color:red;'>Error ".$data['responseStatus'].': '.$data['responseDetails'].'</font>'; |
|
26 | + $this->translation = "<font style='color:red;'>Error ".$data[ 'responseStatus' ].': '.$data[ 'responseDetails' ].'</font>'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | - $transObtained = $data['responseData']['translatedText']; |
|
32 | + $transObtained = $data[ 'responseData' ][ 'translatedText' ]; |
|
33 | 33 | |
34 | 34 | $this->translation = ucfirst(strtolower(trim(str_replace('*', ' ', $transObtained)))); |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $words = explode(' ', $transObtained); |
41 | 41 | foreach ($words as $word) { |
42 | 42 | if ($word != '') { |
43 | - if ($word[0] == '*') { |
|
43 | + if ($word[ 0 ] == '*') { |
|
44 | 44 | $errors = $errors.substr($word, 1).', '; |
45 | 45 | } |
46 | 46 | } |