Completed
Push — master ( 76df68...738942 )
by Aitor Riba
02:11
created
src/Translation.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         if ($this->debug === true) {
106 106
             $this->translation = "<font style='color:#00CC00;'>Loaded correclty from you DB</font>";
107 107
         } else {
108
-            $this->translation = $existing[0]->translation;
108
+            $this->translation = $existing[ 0 ]->translation;
109 109
         }
110 110
 
111 111
         return true;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             return;
151 151
         }
152 152
 
153
-        $available_transoltors = ['apertium', 'mymemory'];
153
+        $available_transoltors = [ 'apertium', 'mymemory' ];
154 154
 
155 155
         // Checks available translators.
156 156
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 $words = explode(' ', $transObtained);
263 263
                 foreach ($words as $word) {
264 264
                     if ($word != '') {
265
-                        if ($word[0] == '*') {
265
+                        if ($word[ 0 ] == '*') {
266 266
                             $errors = $errors.substr($word, 1).', ';
267 267
                         }
268 268
                     }
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -168,58 +168,58 @@
 block discarded – undo
168 168
         }
169 169
     }
170 170
 
171
-     /**
172
-      * Get translation from mymemory API.
173
-      */
174
-     private function mymemoryTrans()
175
-     {
176
-         // Check if it can be translated from online sources.
177
-
178
-         $host = 'api.mymemory.translated.net';
179
-         if ($socket = @fsockopen($host, 80, $errno, $errstr, 30)) {
180
-
181
-             // Host online
182
-             $urlString = urlencode($this->string);
183
-             $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to";
184
-             $json = file_get_contents($url);
185
-             $data = json_decode($json);
186
-
187
-             // Checking response status
188
-
189
-             if ($data->responseStatus != 200) {
190
-                 if ($this->debug == true) {
191
-                     $details = $data->responseDetails;
192
-                     if ($data->responseStatus == 403) {
193
-                         $details = ($data->responseDetails);
194
-                     }
195
-                     $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>';
196
-                 }
171
+        /**
172
+         * Get translation from mymemory API.
173
+         */
174
+        private function mymemoryTrans()
175
+        {
176
+            // Check if it can be translated from online sources.
177
+
178
+            $host = 'api.mymemory.translated.net';
179
+            if ($socket = @fsockopen($host, 80, $errno, $errstr, 30)) {
180
+
181
+                // Host online
182
+                $urlString = urlencode($this->string);
183
+                $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to";
184
+                $json = file_get_contents($url);
185
+                $data = json_decode($json);
186
+
187
+                // Checking response status
188
+
189
+                if ($data->responseStatus != 200) {
190
+                    if ($this->debug == true) {
191
+                        $details = $data->responseDetails;
192
+                        if ($data->responseStatus == 403) {
193
+                            $details = ($data->responseDetails);
194
+                        }
195
+                        $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>';
196
+                    }
197 197
 
198
-                 return;
199
-             }
198
+                    return;
199
+                }
200 200
 
201 201
 
202
-             $transObtained = $data->responseData->translatedText;
202
+                $transObtained = $data->responseData->translatedText;
203 203
 
204
-             $this->translation = ucfirst(strtolower(trim($transObtained)));
204
+                $this->translation = ucfirst(strtolower(trim($transObtained)));
205 205
 
206
-             $this->save();
206
+                $this->save();
207 207
 
208
-             // Checking debug setting to determinate how to output translation
208
+                // Checking debug setting to determinate how to output translation
209 209
 
210
-             if ($this->debug === true) {
211
-                 $this->translation = "<font style='color:#00CC00;'>".$this->translation.'</font>';
212
-             }
210
+                if ($this->debug === true) {
211
+                    $this->translation = "<font style='color:#00CC00;'>".$this->translation.'</font>';
212
+                }
213 213
 
214 214
 
215
-             return;
216
-             fclose($socket);
217
-         } else {
215
+                return;
216
+                fclose($socket);
217
+            } else {
218 218
 
219
-             //host offline
220
-             $this->hostDown();
221
-         }
222
-     }
219
+                //host offline
220
+                $this->hostDown();
221
+            }
222
+        }
223 223
 
224 224
     /**
225 225
      * Get translation from apertium API.
Please login to merge, or discard this patch.
src/Views/translations.blade.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,13 +156,13 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Controllers/LaralangController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/Routes/web.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
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
     });
Please login to merge, or discard this patch.
src/Migrations/2016_11_04_135240_laralang_translations.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.