@@ -156,13 +156,13 @@ |
||
156 | 156 | $( function() { |
157 | 157 | $('#delete').click(function() { |
158 | 158 | <?php $url_route = url('/').'/'.config('laralang.default.prefix').'/delete'; |
159 | - ?> |
|
159 | + ?> |
|
160 | 160 | $.get("{{ $url_route }}"+'/'+$('.trans-id').val()); |
161 | 161 | }); |
162 | 162 | $('#edit').click(function() { |
163 | 163 | var translation = $('.input-trans').val(); |
164 | 164 | <?php $url_route = url('/').'/'.config('laralang.default.prefix').'/edit'; |
165 | - ?> |
|
165 | + ?> |
|
166 | 166 | $.get("{{ $url_route }}"+'/'+$('.trans-id').val()+'/'+translation); |
167 | 167 | }); |
168 | 168 |
@@ -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'); |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | |
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::get('/delete/{id}', 'LaralangController@deleteTrans')->name('delete'); |
13 | 13 | Route::get('/edit/{id}/{translation}', 'LaralangController@editTrans'); |
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 | }); |
@@ -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'); |
@@ -10,7 +10,6 @@ |
||
10 | 10 | /** |
11 | 11 | * Get the trnaslation. |
12 | 12 | * |
13 | - * @param string $string |
|
14 | 13 | * |
15 | 14 | * @return string method of object |
16 | 15 | */ |
@@ -5,44 +5,44 @@ |
||
5 | 5 | class MymemoryTrans extends Translation |
6 | 6 | { |
7 | 7 | |
8 | - /** |
|
9 | - * Get translation from mymemory API. |
|
10 | - */ |
|
11 | - public function main() |
|
12 | - { |
|
13 | - $host = 'api.mymemory.translated.net'; |
|
8 | + /** |
|
9 | + * Get translation from mymemory API. |
|
10 | + */ |
|
11 | + public function main() |
|
12 | + { |
|
13 | + $host = 'api.mymemory.translated.net'; |
|
14 | 14 | |
15 | - // Check if host is online. |
|
16 | - if ($this->checkHost($host)) { |
|
15 | + // Check if host is online. |
|
16 | + if ($this->checkHost($host)) { |
|
17 | 17 | |
18 | - // Host online |
|
19 | - $urlString = urlencode($this->string); |
|
20 | - $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to"; |
|
21 | - $json = file_get_contents($url); |
|
22 | - $data = json_decode($json); |
|
18 | + // Host online |
|
19 | + $urlString = urlencode($this->string); |
|
20 | + $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to"; |
|
21 | + $json = file_get_contents($url); |
|
22 | + $data = json_decode($json); |
|
23 | 23 | |
24 | - // Checking response status |
|
25 | - if ($data->responseStatus != 200) { |
|
26 | - if ($this->debug == true) { |
|
27 | - $details = $data->responseDetails; |
|
28 | - if ($data->responseStatus == 403) { |
|
29 | - $details = ($data->responseDetails); |
|
30 | - } |
|
31 | - $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>'; |
|
32 | - } |
|
24 | + // Checking response status |
|
25 | + if ($data->responseStatus != 200) { |
|
26 | + if ($this->debug == true) { |
|
27 | + $details = $data->responseDetails; |
|
28 | + if ($data->responseStatus == 403) { |
|
29 | + $details = ($data->responseDetails); |
|
30 | + } |
|
31 | + $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>'; |
|
32 | + } |
|
33 | 33 | |
34 | - return; |
|
35 | - } |
|
34 | + return; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - $transObtained = $data->responseData->translatedText; |
|
38 | + $transObtained = $data->responseData->translatedText; |
|
39 | 39 | |
40 | - $this->translation = ucfirst(strtolower(trim($transObtained))); |
|
40 | + $this->translation = ucfirst(strtolower(trim($transObtained))); |
|
41 | 41 | |
42 | - $this->checkSave(); |
|
42 | + $this->checkSave(); |
|
43 | 43 | |
44 | - return; |
|
45 | - } |
|
46 | - } |
|
44 | + return; |
|
45 | + } |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
@@ -151,10 +151,10 @@ |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
154 | - * This fuction is called to know the status of host, and it would set translation if debug is true. |
|
155 | - * |
|
156 | - * @param string $host |
|
157 | - */ |
|
154 | + * This fuction is called to know the status of host, and it would set translation if debug is true. |
|
155 | + * |
|
156 | + * @param string $host |
|
157 | + */ |
|
158 | 158 | public function checkHost($host) |
159 | 159 | { |
160 | 160 | $socket = @fsockopen($host, 80, $errno, $errstr, 30); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | if ($this->debug === true) { |
119 | 119 | $this->translation = "<font style='color:#00CC00;'>Translation loaded from DB</font>"; |
120 | 120 | } else { |
121 | - $this->translation = $existing[0]->translation; |
|
121 | + $this->translation = $existing[ 0 ]->translation; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return true; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function __toString() |
180 | 180 | { |
181 | - if (!$this->loadIfExists()){ |
|
181 | + if (!$this->loadIfExists()) { |
|
182 | 182 | $this->main(); |
183 | 183 | } |
184 | 184 |
@@ -5,14 +5,14 @@ |
||
5 | 5 | class Exception extends Translation |
6 | 6 | { |
7 | 7 | |
8 | - /** |
|
9 | - * Get translation from mymemory API. |
|
10 | - */ |
|
11 | - public function main() |
|
12 | - { |
|
13 | - // Check if it can be translated from online sources. |
|
8 | + /** |
|
9 | + * Get translation from mymemory API. |
|
10 | + */ |
|
11 | + public function main() |
|
12 | + { |
|
13 | + // Check if it can be translated from online sources. |
|
14 | 14 | |
15 | - return; |
|
16 | - } |
|
15 | + return; |
|
16 | + } |
|
17 | 17 | |
18 | 18 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $words = explode(' ', $transObtained); |
44 | 44 | foreach ($words as $word) { |
45 | 45 | if ($word != '') { |
46 | - if ($word[0] == '*') { |
|
46 | + if ($word[ 0 ] == '*') { |
|
47 | 47 | $errors = $errors.substr($word, 1).', '; |
48 | 48 | } |
49 | 49 | } |