Passed
Push — dpa_docker_wrapper_mac ( 9edeea...9420a4 )
by David
08:37
created
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.
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.
Spacing   +23 added lines, -23 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]
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         // but not any hacker stuff like " alert(1)
181 181
     $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)";
182 182
     // List of allowable tags
183
-    $bbtags = array (
183
+    $bbtags = array(
184 184
         "@\[b\](.*?)\[/b\]@is",
185 185
         "@\[i\](.*?)\[/i\]@is",
186 186
         "@\[u\](.*?)\[/u\]@is",
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
     // What the above tags are turned in to
211 211
     if ($export) {
212
-        $htmltags = array (
212
+        $htmltags = array(
213 213
             "<b>\\1</b>",
214 214
             "<i>\\1</i>",
215 215
             "<u>\\1</u>",
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             "<a href=\"https://github.com/BOINC/boinc/wiki/\\1\">\\1</a>",
237 237
         );
238 238
     } else {
239
-        $htmltags = array (
239
+        $htmltags = array(
240 240
             "<b>\\1</b>",
241 241
             "<i>\\1</i>",
242 242
             "<u>\\1</u>",
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     $lasttext = "";
269 269
     $i = 0;
270 270
     // $i<1000 to prevent DoS
271
-    while ($text != $lasttext && $i<1000) {
271
+    while ($text != $lasttext && $i < 1000) {
272 272
         $lasttext = $text;
273 273
         $text = preg_replace($bbtags, $htmltags, $text);
274 274
         $i = $i + 1;
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     return $text;
279 279
 }
280 280
 
281
-function bb2html($text, $export=false) {
281
+function bb2html($text, $export = false) {
282 282
     $text = replace_pre_code($text, $export);
283 283
     return bb2html_aux($text, $export);
284 284
 }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 // for example inside <pre> containers
288 288
 // The original \n was retained after the br when it was added
289 289
 //
290
-function remove_br($text){
290
+function remove_br($text) {
291 291
     return str_replace("<br />", "", $text);
292 292
 }
293 293
 
@@ -295,19 +295,19 @@  discard block
 block discarded – undo
295 295
 //
296 296
 function externalize_links($text) {
297 297
     // TODO:  Convert this to PCRE
298
-    $i=0;
299
-    $linkpos=true;
298
+    $i = 0;
299
+    $linkpos = true;
300 300
     $out = "";
301
-    while (true){
301
+    while (true) {
302 302
         // Find a link
303 303
         //
304
-        $linkpos=strpos($text, "<a ", $i);
305
-        if ($linkpos===false) break;
304
+        $linkpos = strpos($text, "<a ", $i);
305
+        if ($linkpos === false) break;
306 306
 
307 307
         // Replace with target='_new'
308 308
         //
309
-        $out .= substr($text, $i, $linkpos-$i)."<a target=\"_new\" ";
310
-        $i = $linkpos+3;
309
+        $out .= substr($text, $i, $linkpos - $i)."<a target=\"_new\" ";
310
+        $i = $linkpos + 3;
311 311
     }
312 312
     $out .= substr($text, $i);
313 313
     return $out;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 // Converts image tags to links to the images.
317 317
 //
318
-function image_as_link($text){
318
+function image_as_link($text) {
319 319
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
320 320
     $replacement = '<a href=${2}>[Image link]</a>';
321 321
     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.
html/inc/ReCaptcha/RequestParameters.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Stores and formats the parameters for the request to the reCAPTCHA service.
31 31
  */
32
-class RequestParameters
33
-{
32
+class RequestParameters {
34 33
     /**
35 34
      * Site secret.
36 35
      * @var string
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
      * @param string $remoteIp User's IP address.
64 63
      * @param string $version Version of this client library.
65 64
      */
66
-    public function __construct($secret, $response, $remoteIp = null, $version = null)
67
-    {
65
+    public function __construct($secret, $response, $remoteIp = null, $version = null) {
68 66
         $this->secret = $secret;
69 67
         $this->response = $response;
70 68
         $this->remoteIp = $remoteIp;
@@ -76,8 +74,7 @@  discard block
 block discarded – undo
76 74
      *
77 75
      * @return array Array formatted parameters.
78 76
      */
79
-    public function toArray()
80
-    {
77
+    public function toArray() {
81 78
         $params = array('secret' => $this->secret, 'response' => $this->response);
82 79
 
83 80
         if (!is_null($this->remoteIp)) {
@@ -96,8 +93,7 @@  discard block
 block discarded – undo
96 93
      *
97 94
      * @return string Query string formatted parameters.
98 95
      */
99
-    public function toQueryString()
100
-    {
96
+    public function toQueryString() {
101 97
         return http_build_query($this->toArray(), '', '&');
102 98
     }
103 99
 }
Please login to merge, or discard this patch.