Passed
Push — vko_msi_refactor ( 225587 )
by Vitalii
11:56
created
html/inc/cache.inc 3 patches
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 // check cache size every once in a while, purge if too big
109 109
 //
110
-function cache_check_diskspace(){
110
+function cache_check_diskspace() {
111 111
     if ((rand() % CACHE_SIZE_CHECK_FREQ)) return;
112 112
     if (disk_usage("../cache") < MAX_CACHE_USAGE) return;
113 113
     $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     clean_cache($x, "../cache");
117 117
 }
118 118
 
119
-function cache_need_to_regenerate($path, $max_age){
119
+function cache_need_to_regenerate($path, $max_age) {
120 120
     $regenerate = false;
121 121
     $request = apache_request_headers();
122 122
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 }
140 140
 
141 141
 // Returns cached data or false if nothing was found
142
-function get_cached_data($max_age, $params=""){
142
+function get_cached_data($max_age, $params="") {
143 143
     global $no_cache;
144 144
 
145 145
     if ($no_cache) return;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 }
166 166
 
167 167
 // DEPRECATED
168
-function start_cache($max_age, $params=""){
168
+function start_cache($max_age, $params="") {
169 169
     global $no_cache, $caching, $memcache;
170 170
 
171 171
     if ($no_cache) return;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             $regenerate = cache_need_to_regenerate($path, $max_age);
189 189
         }
190 190
         //Is the stored version too old, do we need to regenerate it?
191
-        if ($regenerate){
191
+        if ($regenerate) {
192 192
             // If cached version is too old (or non-existent)
193 193
             // generate the page and write to cache
194 194
             //
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 // write output buffer both to client and to cache
230 230
 // DEPRECATED
231
-function end_cache($max_age,$params=""){
231
+function end_cache($max_age,$params="") {
232 232
     global $no_cache;
233 233
     if ($no_cache) return;
234 234
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     }
254 254
 }
255 255
 
256
-function set_cached_data($max_age, $data, $params=""){
256
+function set_cached_data($max_age, $data, $params="") {
257 257
     // for the benefit of hackers
258 258
     if (strstr($params, "..")) {
259 259
         return "bad params";
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
                 }
100 100
             }
101 101
         }
102
-       @closedir($handle);
102
+        @closedir($handle);
103 103
     }
104 104
     chdir($start_dir);
105 105
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
         mkdir("../cache", 0770);
33 33
         chmod("../cache", 0770);
34 34
     }
35
-    for ($i=0;$i<256;$i++) {
36
-        $j=sprintf("%02x",$i);
35
+    for ($i = 0; $i < 256; $i++) {
36
+        $j = sprintf("%02x", $i);
37 37
         if (!@filemtime("../cache/$j")) {
38 38
             mkdir("../cache/$j", 0770);
39 39
             chmod("../cache/$j", 0770);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     }
42 42
 }
43 43
 
44
-function get_path($params, $phpfile=null) {
44
+function get_path($params, $phpfile = null) {
45 45
     if (!@filemtime("../cache/00")) make_cache_dirs();
46 46
     if ($phpfile) {
47 47
         $z = $phpfile;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     // add a layer of subdirectories for reducing file lookup time
54
-    $sz = substr(md5($z."_".urlencode($params)),1,2);
54
+    $sz = substr(md5($z."_".urlencode($params)), 1, 2);
55 55
     $path = "../cache/".$sz."/".$z;
56 56
     if ($params) {
57 57
         $path = $path."_".urlencode($params);
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 }
61 61
 
62 62
 function disk_usage($dir) {
63
-    $usage=0;
64
-    if ($handle=@opendir($dir)) {
65
-        while ($file=readdir($handle)) {
63
+    $usage = 0;
64
+    if ($handle = @opendir($dir)) {
65
+        while ($file = readdir($handle)) {
66 66
             if (($file != ".") && ($file != "..")) {
67 67
                 if (@is_dir($dir."/".$file)) {
68
-                    $usage+=disk_usage($dir."/".$file);
68
+                    $usage += disk_usage($dir."/".$file);
69 69
                 } else {
70
-                    $usage+=@filesize($dir."/".$file);
70
+                    $usage += @filesize($dir."/".$file);
71 71
                 }
72 72
             }
73 73
         }
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     if (!chdir($dir)) {
82 82
         return;
83 83
     }
84
-    if ($handle=@opendir(".")) {
85
-        while ($file=readdir($handle)) {
84
+    if ($handle = @opendir(".")) {
85
+        while ($file = readdir($handle)) {
86 86
             if ($file == ".") continue;
87 87
             if ($file == "..") continue;
88 88
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             if (@is_dir($file)) {
94 94
                 clean_cache($max_age, $file);
95 95
             } else {
96
-                if ((time()-@filemtime($file))>$max_age) {
96
+                if ((time() - @filemtime($file)) > $max_age) {
97 97
                     //echo "unlinking ".getcwd()."/$file\n";
98 98
                     @unlink($file);
99 99
                 }
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 
108 108
 // check cache size every once in a while, purge if too big
109 109
 //
110
-function cache_check_diskspace(){
111
-    if ((rand() % CACHE_SIZE_CHECK_FREQ)) return;
110
+function cache_check_diskspace() {
111
+    if ((rand()%CACHE_SIZE_CHECK_FREQ)) return;
112 112
     if (disk_usage("../cache") < MAX_CACHE_USAGE) return;
113 113
     $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL,
114 114
         USER_PROFILE_TTL, TOP_PAGES_TTL, INDEX_PAGE_TTL
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     clean_cache($x, "../cache");
117 117
 }
118 118
 
119
-function cache_need_to_regenerate($path, $max_age){
119
+function cache_need_to_regenerate($path, $max_age) {
120 120
     $regenerate = false;
121 121
     $request = apache_request_headers();
122 122
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         // and touch the cached copy so other processes
129 129
         // don't regenerate at the same time
130 130
         //
131
-        if ($lastmodified<time()-$max_age) {
131
+        if ($lastmodified < time() - $max_age) {
132 132
             $regenerate = true;
133 133
             @touch($path);
134 134
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 }
140 140
 
141 141
 // Returns cached data or false if nothing was found
142
-function get_cached_data($max_age, $params=""){
142
+function get_cached_data($max_age, $params = "") {
143 143
     global $no_cache;
144 144
 
145 145
     if ($no_cache) return;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             }
156 156
         } else {
157 157
             cache_check_diskspace();
158
-            $regenerate=cache_need_to_regenerate($path, $max_age);
158
+            $regenerate = cache_need_to_regenerate($path, $max_age);
159 159
             if (!$regenerate) {
160 160
                 return file_get_contents($path);
161 161
             }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 }
166 166
 
167 167
 // DEPRECATED
168
-function start_cache($max_age, $params=""){
168
+function start_cache($max_age, $params = "") {
169 169
     global $no_cache, $caching, $memcache;
170 170
 
171 171
     if ($no_cache) return;
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
             $regenerate = cache_need_to_regenerate($path, $max_age);
189 189
         }
190 190
         //Is the stored version too old, do we need to regenerate it?
191
-        if ($regenerate){
191
+        if ($regenerate) {
192 192
             // If cached version is too old (or non-existent)
193 193
             // generate the page and write to cache
194 194
             //
195 195
             ob_start();
196 196
             ob_implicit_flush(0);
197
-            Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
198
-            Header("Expires: " . gmdate("D, d M Y H:i:s",time()+$max_age) . " GMT");
199
-            Header("Cache-Control: public, max-age=" . $max_age);
197
+            Header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
198
+            Header("Expires: ".gmdate("D, d M Y H:i:s", time() + $max_age)." GMT");
199
+            Header("Cache-Control: public, max-age=".$max_age);
200 200
 
201 201
             // allow the calling page to see cache period
202 202
             //
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
             if (strstr($params, "format=xml")) {
209 209
                 header('Content-type: text/xml');
210 210
             }
211
-            Header("Last-Modified: " . gmdate("D, d M Y H:i:s",$lastmodified) . " GMT");
212
-            Header("Expires: " . gmdate("D, d M Y H:i:s",$lastmodified+$max_age) . " GMT");
213
-            Header("Cache-Control: public, max-age=" . $max_age );
211
+            Header("Last-Modified: ".gmdate("D, d M Y H:i:s", $lastmodified)." GMT");
212
+            Header("Expires: ".gmdate("D, d M Y H:i:s", $lastmodified + $max_age)." GMT");
213
+            Header("Cache-Control: public, max-age=".$max_age);
214 214
             if ($cache && $cache->content) {
215 215
                 echo $cache->content;
216 216
                 exit;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 // write output buffer both to client and to cache
230 230
 // DEPRECATED
231
-function end_cache($max_age,$params=""){
231
+function end_cache($max_age, $params = "") {
232 232
     global $no_cache;
233 233
     if ($no_cache) return;
234 234
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     }
254 254
 }
255 255
 
256
-function set_cached_data($max_age, $data, $params=""){
256
+function set_cached_data($max_age, $data, $params = "") {
257 257
     // for the benefit of hackers
258 258
     if (strstr($params, "..")) {
259 259
         return "bad params";
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         }
296 296
         $server_arr = array();
297 297
         $servers = explode('|', MEMCACHE_SERVERS);
298
-        foreach($servers as &$server) {
298
+        foreach ($servers as &$server) {
299 299
             list($ip, $port, $weight) = explode(':', $server);
300 300
             if (!$port) { $port = 11211; }
301 301
             $server_arr[] = array($ip, $port, $weight);
Please login to merge, or discard this patch.
html/inc/text_transform.inc 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 // Do the actual transformation of the text.
63 63
 // TODO: Make this part of the above class.
64 64
 
65
-function output_transform($text, $options = NULL) {
65
+function output_transform($text, $options = null) {
66 66
     // Options is a output_options object, defined above
67 67
     if (!$options) {
68 68
         $options = new output_options; // Defaults in the class definition
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 require_once('../inc/sanitize_html.inc');
27 27
 
28 28
 class output_options {
29
-    var $bb2html;            // BBCode as HTML? (on)
30
-    var $images_as_links;    // Images as hyperlinks? (off)
31
-    var $link_popup;        // Links in new windows? (off)
32
-    var $nl2br;                // Convert newlines to <br>'s? (on)
33
-    var $htmlitems;            // Convert special chars to HTML entities? (on)
34
-    var $htmlscrub;            // Scrub "bad" HTML tags? (off)
35
-    var $highlight_terms;// Array of terms to be highlighted (off)
29
+    var $bb2html; // BBCode as HTML? (on)
30
+    var $images_as_links; // Images as hyperlinks? (off)
31
+    var $link_popup; // Links in new windows? (off)
32
+    var $nl2br; // Convert newlines to <br>'s? (on)
33
+    var $htmlitems; // Convert special chars to HTML entities? (on)
34
+    var $htmlscrub; // Scrub "bad" HTML tags? (off)
35
+    var $highlight_terms; // Array of terms to be highlighted (off)
36 36
 
37 37
     // Constructor - set the defaults.
38 38
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $options = new output_options; // Defaults in the class definition
69 69
     }
70 70
     if ($options->htmlitems) {
71
-        $text = htmlspecialchars($text, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE);
71
+        $text = htmlspecialchars($text, ENT_COMPAT|ENT_HTML401|ENT_SUBSTITUTE);
72 72
     }
73 73
     if (is_array($options->highlight_terms)) {
74 74
         $text = highlight_terms($text, $options->highlight_terms);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 // If $export is true, don't use BOINC CSS
105 105
 
106 106
 function substr2($s, $n1, $n2) {
107
-    return substr($s, $n1, $n2-$n1);
107
+    return substr($s, $n1, $n2 - $n1);
108 108
 }
109 109
 
110 110
 // process non-nestable constructs: [pre] and [code]
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
     $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)";
179 179
     // List of allowable tags
180
-    $bbtags = array (
180
+    $bbtags = array(
181 181
         "@\[b\](.*?)\[/b\]@is",
182 182
         "@\[i\](.*?)\[/i\]@is",
183 183
         "@\[u\](.*?)\[/u\]@is",
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
     // What the above tags are turned in to
208 208
     if ($export) {
209
-        $htmltags = array (
209
+        $htmltags = array(
210 210
             "<b>\\1</b>",
211 211
             "<i>\\1</i>",
212 212
             "<u>\\1</u>",
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             "<a href=\"https://github.com/BOINC/boinc/wiki/\\1\">\\1</a>",
234 234
         );
235 235
     } else {
236
-        $htmltags = array (
236
+        $htmltags = array(
237 237
             "<b>\\1</b>",
238 238
             "<i>\\1</i>",
239 239
             "<u>\\1</u>",
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     $lasttext = "";
266 266
     $i = 0;
267 267
     // $i<1000 to prevent DoS
268
-    while ($text != $lasttext && $i<1000) {
268
+    while ($text != $lasttext && $i < 1000) {
269 269
         $lasttext = $text;
270 270
         $text = preg_replace($bbtags, $htmltags, $text);
271 271
         $i = $i + 1;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     return $text;
276 276
 }
277 277
 
278
-function bb2html($text, $export=false) {
278
+function bb2html($text, $export = false) {
279 279
     $text = replace_pre_code($text, $export);
280 280
     return bb2html_aux($text, $export);
281 281
 }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 // for example inside <pre> containers
285 285
 // The original \n was retained after the br when it was added
286 286
 //
287
-function remove_br($text){
287
+function remove_br($text) {
288 288
     return str_replace("<br />", "", $text);
289 289
 }
290 290
 
@@ -292,19 +292,19 @@  discard block
 block discarded – undo
292 292
 //
293 293
 function externalize_links($text) {
294 294
     // TODO:  Convert this to PCRE
295
-    $i=0;
296
-    $linkpos=true;
295
+    $i = 0;
296
+    $linkpos = true;
297 297
     $out = "";
298
-    while (true){
298
+    while (true) {
299 299
         // Find a link
300 300
         //
301
-        $linkpos=strpos($text, "<a ", $i);
302
-        if ($linkpos===false) break;
301
+        $linkpos = strpos($text, "<a ", $i);
302
+        if ($linkpos === false) break;
303 303
 
304 304
         // Replace with target='_new'
305 305
         //
306
-        $out .= substr($text, $i, $linkpos-$i)."<a target=\"_new\" ";
307
-        $i = $linkpos+3;
306
+        $out .= substr($text, $i, $linkpos - $i)."<a target=\"_new\" ";
307
+        $i = $linkpos + 3;
308 308
     }
309 309
     $out .= substr($text, $i);
310 310
     return $out;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
 // Converts image tags to links to the images.
314 314
 //
315
-function image_as_link($text){
315
+function image_as_link($text) {
316 316
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
317 317
     $replacement = '<a href=${2}>[Image link]</a>';
318 318
     return preg_replace($pattern, $replacement, $text);
@@ -330,5 +330,5 @@  discard block
 block discarded – undo
330 330
     return str_ireplace($search, $replace, $text);
331 331
 }
332 332
 
333
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
333
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
334 334
 ?>
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 // for example inside <pre> containers
285 285
 // The original \n was retained after the br when it was added
286 286
 //
287
-function remove_br($text){
287
+function remove_br($text) {
288 288
     return str_replace("<br />", "", $text);
289 289
 }
290 290
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     $i=0;
296 296
     $linkpos=true;
297 297
     $out = "";
298
-    while (true){
298
+    while (true) {
299 299
         // Find a link
300 300
         //
301 301
         $linkpos=strpos($text, "<a ", $i);
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
 // Converts image tags to links to the images.
314 314
 //
315
-function image_as_link($text){
315
+function image_as_link($text) {
316 316
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
317 317
     $replacement = '<a href=${2}>[Image link]</a>';
318 318
     return preg_replace($pattern, $replacement, $text);
Please login to merge, or discard this patch.
html/inc/ReCaptcha/ReCaptcha.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * reCAPTCHA client.
31 31
  */
32
-class ReCaptcha
33
-{
32
+class ReCaptcha {
34 33
     /**
35 34
      * Version of this client library.
36 35
      * @const string
@@ -55,8 +54,7 @@  discard block
 block discarded – undo
55 54
      * @param string $secret shared secret between site and reCAPTCHA server.
56 55
      * @param RequestMethod $requestMethod method used to send the request. Defaults to POST.
57 56
      */
58
-    public function __construct($secret, RequestMethod $requestMethod = null)
59
-    {
57
+    public function __construct($secret, RequestMethod $requestMethod = null) {
60 58
         if (empty($secret)) {
61 59
             throw new \RuntimeException('No secret provided');
62 60
         }
@@ -82,8 +80,7 @@  discard block
 block discarded – undo
82 80
      * @param string $remoteIp The end user's IP address.
83 81
      * @return Response Response from the service.
84 82
      */
85
-    public function verify($response, $remoteIp = null)
86
-    {
83
+    public function verify($response, $remoteIp = null) {
87 84
         // Discard empty solution submissions
88 85
         if (empty($response)) {
89 86
             $recaptchaResponse = new Response(false, array('missing-input-response'));
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
 /**
30 30
  * Method used to send the request to the service.
31 31
  */
32
-interface RequestMethod
33
-{
32
+interface RequestMethod {
34 33
 
35 34
     /**
36 35
      * Submit the request with the specified parameters.
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/CurlPost.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
  * Note: this requires the cURL extension to be enabled in PHP
35 35
  * @see http://php.net/manual/en/book.curl.php
36 36
  */
37
-class CurlPost implements RequestMethod
38
-{
37
+class CurlPost implements RequestMethod {
39 38
     /**
40 39
      * URL to which requests are sent via cURL.
41 40
      * @const string
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
      */
49 48
     private $curl;
50 49
 
51
-    public function __construct(Curl $curl = null)
52
-    {
50
+    public function __construct(Curl $curl = null) {
53 51
         if (!is_null($curl)) {
54 52
             $this->curl = $curl;
55 53
         } else {
@@ -63,8 +61,7 @@  discard block
 block discarded – undo
63 61
      * @param RequestParameters $params Request parameters
64 62
      * @return string Body of the reCAPTCHA response
65 63
      */
66
-    public function submit(RequestParameters $params)
67
-    {
64
+    public function submit(RequestParameters $params) {
68 65
         $handle = $this->curl->init(self::SITE_VERIFY_URL);
69 66
 
70 67
         $options = array(
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/Post.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
 /**
33 33
  * Sends POST requests to the reCAPTCHA service.
34 34
  */
35
-class Post implements RequestMethod
36
-{
35
+class Post implements RequestMethod {
37 36
     /**
38 37
      * URL to which requests are POSTed.
39 38
      * @const string
@@ -46,8 +45,7 @@  discard block
 block discarded – undo
46 45
      * @param RequestParameters $params Request parameters
47 46
      * @return string Body of the reCAPTCHA response
48 47
      */
49
-    public function submit(RequestParameters $params)
50
-    {
48
+    public function submit(RequestParameters $params) {
51 49
         /**
52 50
          * PHP 5.6.0 changed the way you specify the peer name for SSL context options.
53 51
          * Using "CN_name" will still work, but it will raise deprecated errors.
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/Socket.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
  * Convenience wrapper around native socket and file functions to allow for
31 31
  * mocking.
32 32
  */
33
-class Socket
34
-{
33
+class Socket {
35 34
     private $handle = null;
36 35
 
37 36
     /**
@@ -45,8 +44,7 @@  discard block
 block discarded – undo
45 44
      * @param float $timeout
46 45
      * @return resource
47 46
      */
48
-    public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null)
49
-    {
47
+    public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null) {
50 48
         $this->handle = fsockopen($hostname, $port, $errno, $errstr, (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout));
51 49
 
52 50
         if ($this->handle != false && $errno === 0 && $errstr === '') {
@@ -63,8 +61,7 @@  discard block
 block discarded – undo
63 61
      * @param int $length
64 62
      * @return int | bool
65 63
      */
66
-    public function fwrite($string, $length = null)
67
-    {
64
+    public function fwrite($string, $length = null) {
68 65
         return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length));
69 66
     }
70 67
 
@@ -75,8 +72,7 @@  discard block
 block discarded – undo
75 72
      * @param int $length
76 73
      * @return string
77 74
      */
78
-    public function fgets($length = null)
79
-    {
75
+    public function fgets($length = null) {
80 76
         return fgets($this->handle, $length);
81 77
     }
82 78
 
@@ -86,8 +82,7 @@  discard block
 block discarded – undo
86 82
      * @see http://php.net/feof
87 83
      * @return bool
88 84
      */
89
-    public function feof()
90
-    {
85
+    public function feof() {
91 86
         return feof($this->handle);
92 87
     }
93 88
 
@@ -97,8 +92,7 @@  discard block
 block discarded – undo
97 92
      * @see http://php.net/fclose
98 93
      * @return bool
99 94
      */
100
-    public function fclose()
101
-    {
95
+    public function fclose() {
102 96
         return fclose($this->handle);
103 97
     }
104 98
 }
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/Curl.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,16 +29,14 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Convenience wrapper around the cURL functions to allow mocking.
31 31
  */
32
-class Curl
33
-{
32
+class Curl {
34 33
 
35 34
     /**
36 35
      * @see http://php.net/curl_init
37 36
      * @param string $url
38 37
      * @return resource cURL handle
39 38
      */
40
-    public function init($url = null)
41
-    {
39
+    public function init($url = null) {
42 40
         return curl_init($url);
43 41
     }
44 42
 
@@ -48,8 +46,7 @@  discard block
 block discarded – undo
48 46
      * @param array $options
49 47
      * @return bool
50 48
      */
51
-    public function setoptArray($ch, array $options)
52
-    {
49
+    public function setoptArray($ch, array $options) {
53 50
         return curl_setopt_array($ch, $options);
54 51
     }
55 52
 
@@ -58,8 +55,7 @@  discard block
 block discarded – undo
58 55
      * @param resource $ch
59 56
      * @return mixed
60 57
      */
61
-    public function exec($ch)
62
-    {
58
+    public function exec($ch) {
63 59
         return curl_exec($ch);
64 60
     }
65 61
 
@@ -67,8 +63,7 @@  discard block
 block discarded – undo
67 63
      * @see http://php.net/curl_close
68 64
      * @param resource $ch
69 65
      */
70
-    public function close($ch)
71
-    {
66
+    public function close($ch) {
72 67
         curl_close($ch);
73 68
     }
74 69
 }
Please login to merge, or discard this patch.
html/inc/ReCaptcha/Response.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * The response returned from the service.
31 31
  */
32
-class Response
33
-{
32
+class Response {
34 33
     /**
35 34
      * Succes or failure.
36 35
      * @var boolean
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
      * @param string $json
50 49
      * @return \ReCaptcha\Response
51 50
      */
52
-    public static function fromJson($json)
53
-    {
51
+    public static function fromJson($json) {
54 52
         $responseData = json_decode($json, true);
55 53
 
56 54
         if (!$responseData) {
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
      * @param boolean $success
75 73
      * @param array $errorCodes
76 74
      */
77
-    public function __construct($success, array $errorCodes = array())
78
-    {
75
+    public function __construct($success, array $errorCodes = array()) {
79 76
         $this->success = $success;
80 77
         $this->errorCodes = $errorCodes;
81 78
     }
@@ -85,8 +82,7 @@  discard block
 block discarded – undo
85 82
      *
86 83
      * @return boolean
87 84
      */
88
-    public function isSuccess()
89
-    {
85
+    public function isSuccess() {
90 86
         return $this->success;
91 87
     }
92 88
 
@@ -95,8 +91,7 @@  discard block
 block discarded – undo
95 91
      *
96 92
      * @return array
97 93
      */
98
-    public function getErrorCodes()
99
-    {
94
+    public function getErrorCodes() {
100 95
         return $this->errorCodes;
101 96
     }
102 97
 }
Please login to merge, or discard this patch.