Passed
Branch master (a3c0d0)
by Cody
02:54
created
lib/accept-to-gettext.php 1 patch
Spacing   +51 added lines, -53 removed lines patch added patch discarded remove patch
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
 
70 70
 /* not really important, this one; perhaps I could've put it inline with
71 71
  * the rest. */
72
-function find_match($curlscore,$curcscore,$curgtlang,$langval,$charval,
72
+function find_match($curlscore, $curcscore, $curgtlang, $langval, $charval,
73 73
                     $gtlang)
74 74
 {
75
-  if($curlscore < $langval) {
76
-    $curlscore=$langval;
77
-    $curcscore=$charval;
78
-    $curgtlang=$gtlang;
75
+  if ($curlscore < $langval) {
76
+    $curlscore = $langval;
77
+    $curcscore = $charval;
78
+    $curgtlang = $gtlang;
79 79
   } else if ($curlscore == $langval) {
80
-    if($curcscore < $charval) {
81
-      $curcscore=$charval;
82
-      $curgtlang=$gtlang;
80
+    if ($curcscore < $charval) {
81
+      $curcscore = $charval;
82
+      $curgtlang = $gtlang;
83 83
     }
84 84
   }
85 85
   return array($curlscore, $curcscore, $curgtlang);
@@ -87,22 +87,20 @@  discard block
 block discarded – undo
87 87
 
88 88
 function al2gt($gettextlangs, $mime) {
89 89
   /* default to "everything is acceptable", as RFC2616 specifies */
90
-  $acceptLang=(($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' :
91
-      $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
92
-  $acceptChar=(($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' :
93
-      $_SERVER["HTTP_ACCEPT_CHARSET"]);
94
-  $alparts=@preg_split("/,/",$acceptLang);
95
-  $acparts=@preg_split("/,/",$acceptChar);
90
+  $acceptLang = (($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' : $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
91
+  $acceptChar = (($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' : $_SERVER["HTTP_ACCEPT_CHARSET"]);
92
+  $alparts = @preg_split("/,/", $acceptLang);
93
+  $acparts = @preg_split("/,/", $acceptChar);
96 94
   
97 95
   /* Parse the contents of the Accept-Language header.*/
98
-  foreach($alparts as $part) {
99
-    $part=trim($part);
100
-    if(preg_match("/;/", $part)) {
101
-      $lang=@preg_split("/;/",$part);
102
-      $score=@preg_split("/=/",$lang[1]);
103
-      $alscores[$lang[0]]=$score[1];
96
+  foreach ($alparts as $part) {
97
+    $part = trim($part);
98
+    if (preg_match("/;/", $part)) {
99
+      $lang = @preg_split("/;/", $part);
100
+      $score = @preg_split("/=/", $lang[1]);
101
+      $alscores[$lang[0]] = $score[1];
104 102
     } else {
105
-      $alscores[$part]=1;
103
+      $alscores[$part] = 1;
106 104
     }
107 105
   }
108 106
 
@@ -116,20 +114,20 @@  discard block
 block discarded – undo
116 114
    * Making it 2 for the time being, so that we
117 115
    * can distinguish between "not specified" and "specified as 1" later
118 116
    * on. */
119
-  $acscores["ISO-8859-1"]=2;
117
+  $acscores["ISO-8859-1"] = 2;
120 118
 
121
-  foreach($acparts as $part) {
122
-    $part=trim($part);
123
-    if(preg_match("/;/", $part)) {
124
-      $cs=@preg_split("/;/",$part);
125
-      $score=@preg_split("/=/",$cs[1]);
126
-      $acscores[strtoupper($cs[0])]=$score[1];
119
+  foreach ($acparts as $part) {
120
+    $part = trim($part);
121
+    if (preg_match("/;/", $part)) {
122
+      $cs = @preg_split("/;/", $part);
123
+      $score = @preg_split("/=/", $cs[1]);
124
+      $acscores[strtoupper($cs[0])] = $score[1];
127 125
     } else {
128
-      $acscores[strtoupper($part)]=1;
126
+      $acscores[strtoupper($part)] = 1;
129 127
     }
130 128
   }
131
-  if($acscores["ISO-8859-1"]==2) {
132
-    $acscores["ISO-8859-1"]=(isset($acscores["*"])?$acscores["*"]:1);
129
+  if ($acscores["ISO-8859-1"] == 2) {
130
+    $acscores["ISO-8859-1"] = (isset($acscores["*"]) ? $acscores["*"] : 1);
133 131
   }
134 132
 
135 133
   /* 
@@ -137,18 +135,18 @@  discard block
 block discarded – undo
137 135
    * with the highest score, excluding the ones with a charset the user
138 136
    * did not include.
139 137
    */
140
-  $curlscore=0;
141
-  $curcscore=0;
142
-  $curgtlang=NULL;
143
-  foreach($gettextlangs as $gtlang) {
138
+  $curlscore = 0;
139
+  $curcscore = 0;
140
+  $curgtlang = NULL;
141
+  foreach ($gettextlangs as $gtlang) {
144 142
 
145
-    $tmp1=preg_replace("/\_/","-",$gtlang);
146
-    $tmp2=@preg_split("/\./",$tmp1);
147
-    $allang=strtolower($tmp2[0]);
148
-    $gtcs=strtoupper($tmp2[1]);
149
-    $noct=@preg_split("/-/",$allang);
143
+    $tmp1 = preg_replace("/\_/", "-", $gtlang);
144
+    $tmp2 = @preg_split("/\./", $tmp1);
145
+    $allang = strtolower($tmp2[0]);
146
+    $gtcs = strtoupper($tmp2[1]);
147
+    $noct = @preg_split("/-/", $allang);
150 148
 
151
-    $testvals=array(
149
+    $testvals = array(
152 150
          array(@$alscores[$allang], @$acscores[$gtcs]),
153 151
      array(@$alscores[$noct[0]], @$acscores[$gtcs]),
154 152
      array(@$alscores[$allang], @$acscores["*"]),
@@ -156,15 +154,15 @@  discard block
 block discarded – undo
156 154
      array(@$alscores["*"], @$acscores[$gtcs]),
157 155
      array(@$alscores["*"], @$acscores["*"]));
158 156
 
159
-    $found=FALSE;
160
-    foreach($testvals as $tval) {
161
-      if(!$found && isset($tval[0]) && isset($tval[1])) {
162
-        $arr=find_match($curlscore, $curcscore, $curgtlang, $tval[0],
157
+    $found = FALSE;
158
+    foreach ($testvals as $tval) {
159
+      if (!$found && isset($tval[0]) && isset($tval[1])) {
160
+        $arr = find_match($curlscore, $curcscore, $curgtlang, $tval[0],
163 161
               $tval[1], $gtlang);
164
-        $curlscore=$arr[0];
165
-        $curcscore=$arr[1];
166
-        $curgtlang=$arr[2];
167
-    $found=TRUE;
162
+        $curlscore = $arr[0];
163
+        $curcscore = $arr[1];
164
+        $curgtlang = $arr[2];
165
+    $found = TRUE;
168 166
       }
169 167
     }
170 168
   }
@@ -172,10 +170,10 @@  discard block
 block discarded – undo
172 170
   /* We must re-parse the gettext-string now, since we may have found it
173 171
    * through a "*" qualifier.*/
174 172
   
175
-  $gtparts=@preg_split("/\./",$curgtlang);
176
-  $tmp=strtolower($gtparts[0]);
177
-  $lang=preg_replace("/\_/", "-", $tmp);
178
-  $charset=$gtparts[1];
173
+  $gtparts = @preg_split("/\./", $curgtlang);
174
+  $tmp = strtolower($gtparts[0]);
175
+  $lang = preg_replace("/\_/", "-", $tmp);
176
+  $charset = $gtparts[1];
179 177
 
180 178
   header("Content-Language: $lang");
181 179
   header("Content-Type: $mime; charset=$charset");
Please login to merge, or discard this patch.
lib/gettext/gettext.inc 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 // LC_MESSAGES is not available if php-gettext is not loaded
36 36
 // while the other constants are already available from session extension.
37 37
 if (!defined('LC_MESSAGES')) {
38
-  define('LC_MESSAGES',	5);
38
+  define('LC_MESSAGES', 5);
39 39
 }
40 40
 
41 41
 require('streams.php');
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     if (preg_match("/^(?P<lang>[a-z]{2,3})"              // language code
78 78
                    ."(?:_(?P<country>[A-Z]{2}))?"           // country code
79 79
                    ."(?:\.(?P<charset>[-A-Za-z0-9_]+))?"    // charset
80
-                   ."(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/",  // @ modifier
80
+                   ."(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/", // @ modifier
81 81
                    $locale, $matches)) {
82 82
 
83 83
       if (isset($matches["lang"])) $lang = $matches["lang"];
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 /**
114 114
  * Utility function to get a StreamReader for the given text domain.
115 115
  */
116
-function _get_reader($domain=null, $category=5, $enable_cache=true) {
116
+function _get_reader($domain = null, $category = 5, $enable_cache = true) {
117 117
     global $text_domains, $default_domain, $LC_CATEGORIES;
118 118
     if (!isset($domain)) $domain = $default_domain;
119 119
     if (!isset($text_domains[$domain]->l10n)) {
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
         $locale = _setlocale(LC_MESSAGES, 0);
122 122
         $bound_path = isset($text_domains[$domain]->path) ?
123 123
           $text_domains[$domain]->path : './';
124
-        $subpath = $LC_CATEGORIES[$category] ."/$domain.mo";
124
+        $subpath = $LC_CATEGORIES[$category]."/$domain.mo";
125 125
 
126 126
         $locale_names = get_list_of_locales($locale);
127 127
         $input = null;
128 128
         foreach ($locale_names as $locale) {
129
-          $full_path = $bound_path . $locale . "/" . $subpath;
129
+          $full_path = $bound_path.$locale."/".$subpath;
130 130
           if (file_exists($full_path)) {
131 131
             $input = new FileReader($full_path);
132 132
             break;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 /**
155 155
  * Checks if the current locale is supported on this system.
156 156
  */
157
-function _check_locale_and_function($function=false) {
157
+function _check_locale_and_function($function = false) {
158 158
     global $EMULATEGETTEXT;
159 159
     if ($function and !function_exists($function))
160 160
         return false;
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 /**
165 165
  * Get the codeset for the given domain.
166 166
  */
167
-function _get_codeset($domain=null) {
167
+function _get_codeset($domain = null) {
168 168
     global $text_domains, $default_domain, $LC_CATEGORIES;
169 169
     if (!isset($domain)) $domain = $default_domain;
170
-    return (isset($text_domains[$domain]->codeset))? $text_domains[$domain]->codeset : ini_get('mbstring.internal_encoding');
170
+    return (isset($text_domains[$domain]->codeset)) ? $text_domains[$domain]->codeset : ini_get('mbstring.internal_encoding');
171 171
 }
172 172
 
173 173
 /**
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
     global $text_domains;
242 242
     // ensure $path ends with a slash ('/' should work for both, but lets still play nice)
243 243
     if (substr(php_uname(), 0, 7) == "Windows") {
244
-      if ($path[strlen($path)-1] != '\\' and $path[strlen($path)-1] != '/')
244
+      if ($path[strlen($path) - 1] != '\\' and $path[strlen($path) - 1] != '/')
245 245
         $path .= '\\';
246 246
     } else {
247
-      if ($path[strlen($path)-1] != '/')
247
+      if ($path[strlen($path) - 1] != '/')
248 248
         $path .= '/';
249 249
     }
250 250
     if (!array_key_exists($domain, $text_domains)) {
Please login to merge, or discard this patch.
lib/gettext/streams.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
   var $_pos;
50 50
   var $_str;
51 51
 
52
-  function StringReader($str='') {
52
+  function StringReader($str = '') {
53 53
     $this->_str = $str;
54 54
     $this->_pos = 0;
55 55
   }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
   function read($bytes) {
58 58
     $data = substr($this->_str, $this->_pos, $bytes);
59 59
     $this->_pos += $bytes;
60
-    if (strlen($this->_str)<$this->_pos)
60
+    if (strlen($this->_str) < $this->_pos)
61 61
       $this->_pos = strlen($this->_str);
62 62
 
63 63
     return $data;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
   function seekto($pos) {
67 67
     $this->_pos = $pos;
68
-    if (strlen($this->_str)<$this->_pos)
68
+    if (strlen($this->_str) < $this->_pos)
69 69
       $this->_pos = strlen($this->_str);
70 70
     return $this->_pos;
71 71
   }
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
   function FileReader($filename) {
90 90
     if (file_exists($filename)) {
91 91
 
92
-      $this->_length=filesize($filename);
92
+      $this->_length = filesize($filename);
93 93
       $this->_pos = 0;
94
-      $this->_fd = fopen($filename,'rb');
94
+      $this->_fd = fopen($filename, 'rb');
95 95
       if (!$this->_fd) {
96 96
         $this->error = 3; // Cannot read file, probably permissions
97 97
         return false;
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
   function CachedFileReader($filename) {
147 147
     if (file_exists($filename)) {
148 148
 
149
-      $length=filesize($filename);
150
-      $fd = fopen($filename,'rb');
149
+      $length = filesize($filename);
150
+      $fd = fopen($filename, 'rb');
151 151
 
152 152
       if (!$fd) {
153 153
         $this->error = 3; // Cannot read file, probably permissions
Please login to merge, or discard this patch.
lib/gettext/gettext.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
    var $error = 0; // public variable that holds error code (0 if no error)
39 39
 
40 40
    //private:
41
-  var $BYTEORDER = 0;        // 0: low endian, 1: big endian
41
+  var $BYTEORDER = 0; // 0: low endian, 1: big endian
42 42
   var $STREAM = NULL;
43 43
   var $short_circuit = false;
44 44
   var $enable_cache = false;
45
-  var $originals = NULL;      // offset of original table
46
-  var $translations = NULL;    // offset of translation table
47
-  var $pluralheader = NULL;    // cache header field for plural forms
48
-  var $total = 0;          // total string count
49
-  var $table_originals = NULL;  // table for original strings (offsets)
50
-  var $table_translations = NULL;  // table for translated strings (offsets)
51
-  var $cache_translations = NULL;  // original -> translation mapping
45
+  var $originals = NULL; // offset of original table
46
+  var $translations = NULL; // offset of translation table
47
+  var $pluralheader = NULL; // cache header field for plural forms
48
+  var $total = 0; // total string count
49
+  var $table_originals = NULL; // table for original strings (offsets)
50
+  var $table_translations = NULL; // table for translated strings (offsets)
51
+  var $cache_translations = NULL; // original -> translation mapping
52 52
 
53 53
 
54 54
   /* Methods */
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
   function readint() {
64 64
       if ($this->BYTEORDER == 0) {
65 65
         // low endian
66
-        $input=unpack('V', $this->STREAM->read(4));
66
+        $input = unpack('V', $this->STREAM->read(4));
67 67
         return array_shift($input);
68 68
       } else {
69 69
         // big endian
70
-        $input=unpack('N', $this->STREAM->read(4));
70
+        $input = unpack('N', $this->STREAM->read(4));
71 71
         return array_shift($input);
72 72
       }
73 73
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
    */
101 101
   function __construct($Reader, $enable_cache = true) {
102 102
     // If there isn't a StreamReader, turn on short circuit mode.
103
-    if (! $Reader || isset($Reader->error) ) {
103
+    if (!$Reader || isset($Reader->error)) {
104 104
       $this->short_circuit = true;
105 105
       return;
106 106
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     }
155 155
 
156 156
     if ($this->enable_cache) {
157
-      $this->cache_translations = array ();
157
+      $this->cache_translations = array();
158 158
       /* read all strings in the cache */
159 159
       for ($i = 0; $i < $this->total; $i++) {
160 160
         $this->STREAM->seekto($this->table_originals[$i * 2 + 2]);
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
   function get_original_string($num) {
177 177
     $length = $this->table_originals[$num * 2 + 1];
178 178
     $offset = $this->table_originals[$num * 2 + 2];
179
-    if (! $length)
179
+    if (!$length)
180 180
       return '';
181 181
     $this->STREAM->seekto($offset);
182 182
     $data = $this->STREAM->read($length);
183
-    return (string)$data;
183
+    return (string) $data;
184 184
   }
185 185
 
186 186
   /**
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
   function get_translation_string($num) {
194 194
     $length = $this->table_translations[$num * 2 + 1];
195 195
     $offset = $this->table_translations[$num * 2 + 2];
196
-    if (! $length)
196
+    if (!$length)
197 197
       return '';
198 198
     $this->STREAM->seekto($offset);
199 199
     $data = $this->STREAM->read($length);
200
-    return (string)$data;
200
+    return (string) $data;
201 201
   }
202 202
 
203 203
   /**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
       return $this->find_string($string, $end, $start);
228 228
     } else {
229 229
       // Divide table in two parts
230
-      $half = (int)(($start + $end) / 2);
230
+      $half = (int) (($start + $end) / 2);
231 231
       $cmp = strcmp($string, $this->get_original_string($half));
232 232
       if ($cmp == 0)
233 233
         // string is exactly in the middle => return it
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
         $res .= ') : (';
295 295
         break;
296 296
       case ';':
297
-        $res .= str_repeat( ')', $p) . ';';
297
+        $res .= str_repeat(')', $p).';';
298 298
         $p = 0;
299 299
         break;
300 300
       default:
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     $this->load_tables();
331 331
 
332 332
     // cache header field for plural forms
333
-    if (! is_string($this->pluralheader)) {
333
+    if (!is_string($this->pluralheader)) {
334 334
       if ($this->enable_cache) {
335 335
         $header = $this->cache_translations[""];
336 336
       } else {
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
   function select_string($n) {
353 353
     if (!is_int($n)) {
354 354
       throw new InvalidArgumentException(
355
-        "Select_string only accepts integers: " . $n);
355
+        "Select_string only accepts integers: ".$n);
356 356
     }
357 357
     $string = $this->get_plural_forms();
358
-    $string = str_replace('nplurals',"\$total",$string);
359
-    $string = str_replace("n",$n,$string);
360
-    $string = str_replace('plural',"\$plural",$string);
358
+    $string = str_replace('nplurals', "\$total", $string);
359
+    $string = str_replace("n", $n, $string);
360
+    $string = str_replace('plural', "\$plural", $string);
361 361
 
362 362
     $total = 0;
363 363
     $plural = 0;
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
     $select = $this->select_string($number);
389 389
 
390 390
     // this should contains all strings separated by NULLs
391
-    $key = $single . chr(0) . $plural;
391
+    $key = $single.chr(0).$plural;
392 392
 
393 393
 
394 394
     if ($this->enable_cache) {
395
-      if (! array_key_exists($key, $this->cache_translations)) {
395
+      if (!array_key_exists($key, $this->cache_translations)) {
396 396
         return ($number != 1) ? $plural : $single;
397 397
       } else {
398 398
         $result = $this->cache_translations[$key];
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
   }
413 413
 
414 414
   function pgettext($context, $msgid) {
415
-    $key = $context . chr(4) . $msgid;
415
+    $key = $context.chr(4).$msgid;
416 416
     $ret = $this->translate($key);
417 417
     if (strpos($ret, "\004") !== FALSE) {
418 418
       return $msgid;
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
   }
423 423
 
424 424
   function npgettext($context, $singular, $plural, $number) {
425
-    $key = $context . chr(4) . $singular;
425
+    $key = $context.chr(4).$singular;
426 426
     $ret = $this->ngettext($key, $plural, $number);
427 427
     if (strpos($ret, "\004") !== FALSE) {
428 428
       return $singular;
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
 	// we need a separate check here because functions.php might get parsed
13 13
 	// incorrectly before 5.3 because of :: syntax.
14 14
 	if (version_compare(PHP_VERSION, '5.6.0', '<')) {
15
-		print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".\n";
15
+		print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using ".PHP_VERSION.".\n";
16 16
 		exit;
17 17
 	}
18 18
 
19
-	set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
19
+	set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR.
20 20
 		get_include_path());
21 21
 
22 22
 	require_once "autoload.php";
Please login to merge, or discard this patch.
errors.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@
 block discarded – undo
6 6
 
7 7
 $ERRORS[0] = "";
8 8
 
9
-$ERRORS[1] = __("This program requires XmlHttpRequest " .
9
+$ERRORS[1] = __("This program requires XmlHttpRequest ".
10 10
         "to function properly. Your browser doesn't seem to support it.");
11 11
 
12
-$ERRORS[2] = __("This program requires cookies " .
12
+$ERRORS[2] = __("This program requires cookies ".
13 13
         "to function properly. Your browser doesn't seem to support them.");
14 14
 
15 15
 $ERRORS[3] = __("Backend sanity check failed.");
Please login to merge, or discard this patch.
classes/rpc.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 					$new_feed_id = $row['id'];
238 238
 				} else {
239 239
 					$row = $this->pdo->query("SELECT MAX(id) AS id FROM ttrss_archived_feeds")->fetch();
240
-					$new_feed_id = (int)$row['id'] + 1;
240
+					$new_feed_id = (int) $row['id'] + 1;
241 241
 
242 242
 					$sth = $this->pdo->prepare("INSERT INTO ttrss_archived_feeds
243 243
 						(id, owner_uid, title, feed_url, site_url, created)
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	/* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */
288 288
 	public function catchupSelected() {
289 289
 		$ids = explode(",", clean($_REQUEST["ids"]));
290
-		$cmode = (int)clean($_REQUEST["cmode"]);
290
+		$cmode = (int) clean($_REQUEST["cmode"]);
291 291
 
292 292
 		Article::catchupArticlesById($ids, $cmode);
293 293
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
 	public function markSelected() {
298 298
 		$ids = explode(",", clean($_REQUEST["ids"]));
299
-		$cmode = (int)clean($_REQUEST["cmode"]);
299
+		$cmode = (int) clean($_REQUEST["cmode"]);
300 300
 
301 301
 		$this->markArticlesById($ids, $cmode);
302 302
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
 	public function publishSelected() {
307 307
 		$ids = explode(",", clean($_REQUEST["ids"]));
308
-		$cmode = (int)clean($_REQUEST["cmode"]);
308
+		$cmode = (int) clean($_REQUEST["cmode"]);
309 309
 
310 310
 		$this->publishArticlesById($ids, $cmode);
311 311
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 
343 343
 		print "<ul>";
344 344
 		while ($line = $sth->fetch()) {
345
-			print "<li>" . $line["caption"] . "</li>";
345
+			print "<li>".$line["caption"]."</li>";
346 346
 		}
347 347
 		print "</ul>";
348 348
 	}
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 
579 579
 		if ($msg) {
580 580
 			Logger::get()->log_error(E_USER_WARNING,
581
-				$msg, 'client-js:' . $file, $line, $context);
581
+				$msg, 'client-js:'.$file, $line, $context);
582 582
 
583 583
 			echo json_encode(array("message" => "HOST_ERROR_LOGGED"));
584 584
 		} else {
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 				$content = json_decode($content, true);
603 603
 
604 604
 				if ($content && isset($content["changeset"])) {
605
-					if ($git_timestamp < (int)$content["changeset"]["timestamp"] &&
605
+					if ($git_timestamp < (int) $content["changeset"]["timestamp"] &&
606 606
 						$git_commit != $content["changeset"]["id"]) {
607 607
 
608 608
 						$rv = $content["changeset"];
Please login to merge, or discard this patch.
classes/article.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	public static function create_published_article($title, $url, $content, $labels_str,
31 31
 			$owner_uid) {
32 32
 
33
-		$guid = 'SHA1:' . sha1("ttshared:" . $url . $owner_uid); // include owner_uid to prevent global GUID clash
33
+		$guid = 'SHA1:'.sha1("ttshared:".$url.$owner_uid); // include owner_uid to prevent global GUID clash
34 34
 
35 35
 		if (!$content) {
36 36
 			$pluginhost = new PluginHost();
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 					content = ?, content_hash = ? WHERE id = ?");
86 86
 				$sth->execute([$content, $content_hash, $ref_id]);
87 87
 
88
-				if (DB_TYPE == "pgsql"){
88
+				if (DB_TYPE == "pgsql") {
89 89
 					$sth = $pdo->prepare("UPDATE ttrss_entries
90 90
 					SET tsvector_combined = to_tsvector( :ts_content)
91 91
 					WHERE id = :id");
92 92
 					$params = [
93
-						":ts_content" => mb_substr(strip_tags($content ), 0, 900000),
93
+						":ts_content" => mb_substr(strip_tags($content), 0, 900000),
94 94
 						":id" => $ref_id];
95 95
 					$sth->execute($params);
96 96
 				}
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 
131 131
 			if ($row = $sth->fetch()) {
132 132
 				$ref_id = $row["id"];
133
-				if (DB_TYPE == "pgsql"){
133
+				if (DB_TYPE == "pgsql") {
134 134
 					$sth = $pdo->prepare("UPDATE ttrss_entries
135 135
 					SET tsvector_combined = to_tsvector( :ts_content)
136 136
 					WHERE id = :id");
137 137
 					$params = [
138
-						":ts_content" => mb_substr(strip_tags($content ), 0, 900000),
138
+						":ts_content" => mb_substr(strip_tags($content), 0, 900000),
139 139
 						":id" => $ref_id];
140 140
 					$sth->execute($params);
141 141
 				}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		print_hidden("op", "article");
174 174
 		print_hidden("method", "setArticleTags");
175 175
 
176
-		print "<header class='horizontal'>" . __("Tags for this article (separated by commas):")."</header>";
176
+		print "<header class='horizontal'>".__("Tags for this article (separated by commas):")."</header>";
177 177
 
178 178
 		print "<section>";
179 179
 		print "<textarea dojoType='dijit.form.SimpleTextarea' rows='4'
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
 	public function setScore() {
196 196
 		$ids = explode(",", clean($_REQUEST['id']));
197
-		$score = (int)clean($_REQUEST['score']);
197
+		$score = (int) clean($_REQUEST['score']);
198 198
 
199 199
 		$ids_qmarks = arr_qmarks($ids);
200 200
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
 		$sth->execute(array_merge([$score], $ids, [$_SESSION['uid']]));
205 205
 
206
-		print json_encode(["id" => $ids, "score" => (int)$score]);
206
+		print json_encode(["id" => $ids, "score" => (int) $score]);
207 207
 	}
208 208
 
209 209
 	public function getScore() {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
 		$score = $row['score'];
217 217
 
218
-		print json_encode(["id" => $id, "score" => (int)$score]);
218
+		print json_encode(["id" => $id, "score" => (int) $score]);
219 219
 	}
220 220
 
221 221
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 
294 294
 		print "<ul>";
295 295
 		while ($line = $sth->fetch()) {
296
-			print "<li>" . $line["tag_name"] . "</li>";
296
+			print "<li>".$line["tag_name"]."</li>";
297 297
 		}
298 298
 		print "</ul>";
299 299
 	}
@@ -432,21 +432,21 @@  discard block
 block discarded – undo
432 432
 								if (!$hide_images) {
433 433
 									$encsize = '';
434 434
 									if ($entry['height'] > 0)
435
-										$encsize .= ' height="' . intval($entry['height']) . '"';
435
+										$encsize .= ' height="'.intval($entry['height']).'"';
436 436
 									if ($entry['width'] > 0)
437
-										$encsize .= ' width="' . intval($entry['width']) . '"';
437
+										$encsize .= ' width="'.intval($entry['width']).'"';
438 438
 									$rv .= "<p><img
439 439
 										alt=\"".htmlspecialchars($entry["filename"])."\"
440
-										src=\"" .htmlspecialchars($entry["url"]) . "\"
441
-										" . $encsize . " /></p>";
440
+										src=\"" .htmlspecialchars($entry["url"])."\"
441
+										" . $encsize." /></p>";
442 442
 								} else {
443 443
 									$rv .= "<p><a target=\"_blank\" rel=\"noopener noreferrer\"
444 444
 										href=\"".htmlspecialchars($entry["url"])."\"
445
-										>" .htmlspecialchars($entry["url"]) . "</a></p>";
445
+										>" .htmlspecialchars($entry["url"])."</a></p>";
446 446
 								}
447 447
 
448 448
 								if ($entry['title']) {
449
-									$rv.= "<div class=\"enclosure_title\">${entry['title']}</div>";
449
+									$rv .= "<div class=\"enclosure_title\">${entry['title']}</div>";
450 450
 								}
451 451
 							}
452 452
 						}
@@ -461,13 +461,13 @@  discard block
 block discarded – undo
461 461
 			}
462 462
 
463 463
 			$rv .= "<div class=\"attachments\" dojoType=\"fox.form.DropDownButton\">".
464
-				"<span>" . __('Attachments')."</span>";
464
+				"<span>".__('Attachments')."</span>";
465 465
 
466 466
 			$rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
467 467
 
468 468
 			foreach ($entries as $entry) {
469 469
 				if ($entry["title"])
470
-					$title = " &mdash; " . truncate_string($entry["title"], 30);
470
+					$title = " &mdash; ".truncate_string($entry["title"], 30);
471 471
 				else
472 472
 					$title = "";
473 473
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 					$filename = "";
478 478
 
479 479
 				$rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")'
480
-					dojoType=\"dijit.MenuItem\">".$filename . $title."</div>";
480
+					dojoType=\"dijit.MenuItem\">".$filename.$title."</div>";
481 481
 
482 482
 			};
483 483
 
@@ -546,10 +546,10 @@  discard block
 block discarded – undo
546 546
 			$tags_str = "";
547 547
 
548 548
 			for ($i = 0; $i < $maxtags; $i++) {
549
-				$tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, ";
549
+				$tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">".$tags[$i]."</a>, ";
550 550
 			}
551 551
 
552
-			$tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2);
552
+			$tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str) - 2);
553 553
 
554 554
 			if (count($tags) > $maxtags)
555 555
 				$tags_str .= ", &hellip;";
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 		if (!$article_image && !$article_stream) {
742 742
 			$tmpdoc = new DOMDocument();
743 743
 
744
-			if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">' . mb_substr($content, 0, 131070))) {
744
+			if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">'.mb_substr($content, 0, 131070))) {
745 745
 				$tmpxpath = new DOMXPath($tmpdoc);
746 746
 				$elems = $tmpxpath->query('(//img[@src]|//video[@poster]|//iframe[contains(@src , "youtube.com/embed/")])');
747 747
 
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 					if ($e->nodeName == "iframe") {
750 750
 						$matches = [];
751 751
 						if (preg_match("/\/embed\/([\w-]+)/", $e->getAttribute("src"), $matches)) {
752
-							$article_image = "https://img.youtube.com/vi/" . $matches[1] . "/hqdefault.jpg";
753
-							$article_stream = "https://youtu.be/" . $matches[1];
752
+							$article_image = "https://img.youtube.com/vi/".$matches[1]."/hqdefault.jpg";
753
+							$article_stream = "https://youtu.be/".$matches[1];
754 754
 							break;
755 755
 						}
756 756
 					} else if ($e->nodeName == "video") {
Please login to merge, or discard this patch.
classes/api.php 1 patch
Spacing   +21 added lines, -22 removed lines patch added patch discarded remove patch
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 		}
75 75
 
76 76
 		if (get_pref("ENABLE_API_ACCESS", $uid)) {
77
-			if (authenticate_user($login, $password, false,  Auth_Base::AUTH_SERVICE_API)) {               // try login with normal password
77
+			if (authenticate_user($login, $password, false, Auth_Base::AUTH_SERVICE_API)) {               // try login with normal password
78 78
 				$this->wrap(self::STATUS_OK, array("session_id" => session_id(),
79 79
 					"api_level" => self::API_LEVEL));
80 80
 			} else if (authenticate_user($login, $password_base64, false, Auth_Base::AUTH_SERVICE_API)) { // else try with base64_decoded password
81
-				$this->wrap(self::STATUS_OK,	array("session_id" => session_id(),
81
+				$this->wrap(self::STATUS_OK, array("session_id" => session_id(),
82 82
 					"api_level" => self::API_LEVEL));
83 83
 			} else {                                                         // else we are not logged in
84 84
 				user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 			}
170 170
 		}
171 171
 
172
-		foreach (array(-2,-1,0) as $cat_id) {
172
+		foreach (array(-2, -1, 0) as $cat_id) {
173 173
 			if ($include_empty || !$this->isCategoryEmpty($cat_id)) {
174 174
 				$unread = getFeedUnread($cat_id, true);
175 175
 
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 
191 191
 			if (is_numeric($feed_id)) $feed_id = (int) $feed_id;
192 192
 
193
-			$limit = (int)clean($_REQUEST["limit"]);
193
+			$limit = (int) clean($_REQUEST["limit"]);
194 194
 
195 195
 			if (!$limit || $limit >= 200) $limit = 200;
196 196
 
197
-			$offset = (int)clean($_REQUEST["skip"]);
197
+			$offset = (int) clean($_REQUEST["skip"]);
198 198
 			$filter = clean($_REQUEST["filter"]);
199 199
 			$is_cat = API::param_to_bool(clean($_REQUEST["is_cat"]));
200 200
 			$show_excerpt = API::param_to_bool(clean($_REQUEST["show_excerpt"]));
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 			/* all_articles, unread, adaptive, marked, updated */
203 203
 			$view_mode = clean($_REQUEST["view_mode"]);
204 204
 			$include_attachments = API::param_to_bool(clean($_REQUEST["include_attachments"]));
205
-			$since_id = (int)clean($_REQUEST["since_id"]);
205
+			$since_id = (int) clean($_REQUEST["since_id"]);
206 206
 			$include_nested = API::param_to_bool(clean($_REQUEST["include_nested"]));
207 207
 			$sanitize_content = !isset($_REQUEST["sanitize"]) ||
208 208
 				API::param_to_bool($_REQUEST["sanitize"]);
209 209
 			$force_update = API::param_to_bool(clean($_REQUEST["force_update"]));
210 210
 			$has_sandbox = API::param_to_bool(clean($_REQUEST["has_sandbox"]));
211
-			$excerpt_length = (int)clean($_REQUEST["excerpt_length"]);
212
-			$check_first_id = (int)clean($_REQUEST["check_first_id"]);
211
+			$excerpt_length = (int) clean($_REQUEST["excerpt_length"]);
212
+			$check_first_id = (int) clean($_REQUEST["check_first_id"]);
213 213
 			$include_header = API::param_to_bool(clean($_REQUEST["include_header"]));
214 214
 
215 215
 			$_SESSION['hasSandbox'] = $has_sandbox;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		$article_ids = explode(",", clean($_REQUEST["article_ids"]));
254 254
 		$mode = (int) clean($_REQUEST["mode"]);
255 255
 		$data = clean($_REQUEST["data"]);
256
-		$field_raw = (int)clean($_REQUEST["field"]);
256
+		$field_raw = (int) clean($_REQUEST["field"]);
257 257
 
258 258
 		$field = "";
259 259
 		$set_to = "";
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 					"updated" => (int) strtotime($line["updated"]),
361 361
 					"feed_id" => $line["feed_id"],
362 362
 					"attachments" => $attachments,
363
-					"score" => (int)$line["score"],
363
+					"score" => (int) $line["score"],
364 364
 					"feed_title" => $line["feed_title"],
365 365
 					"note" => $line["note"],
366 366
 					"lang" => $line["lang"]
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	}
435 435
 
436 436
 	public function getLabels() {
437
-		$article_id = (int)clean($_REQUEST['article_id']);
437
+		$article_id = (int) clean($_REQUEST['article_id']);
438 438
 
439 439
 		$rv = array();
440 440
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			}
460 460
 
461 461
 			array_push($rv, array(
462
-				"id" => (int)Labels::label_to_feed_id($line['id']),
462
+				"id" => (int) Labels::label_to_feed_id($line['id']),
463 463
 				"caption" => $line['caption'],
464 464
 				"fg_color" => $line['fg_color'],
465 465
 				"bg_color" => $line['bg_color'],
@@ -644,10 +644,10 @@  discard block
 block discarded – undo
644 644
 					$row = array(
645 645
 							"feed_url" => $line["feed_url"],
646 646
 							"title" => $line["title"],
647
-							"id" => (int)$line["id"],
648
-							"unread" => (int)$unread,
647
+							"id" => (int) $line["id"],
648
+							"unread" => (int) $unread,
649 649
 							"has_icon" => $has_icon,
650
-							"cat_id" => (int)$line["cat_id"],
650
+							"cat_id" => (int) $line["cat_id"],
651 651
 							"last_updated" => (int) strtotime($line["last_updated"]),
652 652
 							"order_id" => (int) $line["order_id"],
653 653
 						);
@@ -748,12 +748,12 @@  discard block
 block discarded – undo
748 748
 					if (!is_array($labels)) $labels = Article::get_article_labels($line["id"]);
749 749
 
750 750
 					$headline_row = array(
751
-						"id" => (int)$line["id"],
751
+						"id" => (int) $line["id"],
752 752
 						"guid" => $line["guid"],
753 753
 						"unread" => API::param_to_bool($line["unread"]),
754 754
 						"marked" => API::param_to_bool($line["marked"]),
755 755
 						"published" => API::param_to_bool($line["published"]),
756
-						"updated" => (int)strtotime($line["updated"]),
756
+						"updated" => (int) strtotime($line["updated"]),
757 757
 						"is_updated" => $is_updated,
758 758
 						"title" => $line["title"],
759 759
 						"link" => $line["link"],
@@ -786,17 +786,16 @@  discard block
 block discarded – undo
786 786
 
787 787
 					$headline_row["labels"] = $labels;
788 788
 
789
-					$headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] :
790
-						$feed_title;
789
+					$headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title;
791 790
 
792
-					$headline_row["comments_count"] = (int)$line["num_comments"];
791
+					$headline_row["comments_count"] = (int) $line["num_comments"];
793 792
 					$headline_row["comments_link"] = $line["comments"];
794 793
 
795 794
 					$headline_row["always_display_attachments"] = API::param_to_bool($line["always_display_enclosures"]);
796 795
 
797 796
 					$headline_row["author"] = $line["author"];
798 797
 
799
-					$headline_row["score"] = (int)$line["score"];
798
+					$headline_row["score"] = (int) $line["score"];
800 799
 					$headline_row["note"] = $line["note"];
801 800
 					$headline_row["lang"] = $line["lang"];
802 801
 
@@ -858,7 +857,7 @@  discard block
 block discarded – undo
858 857
 		$_REQUEST['mode'] = 2;
859 858
 		$_REQUEST['force_show_empty'] = $include_empty;
860 859
 
861
-		if ($pf){
860
+		if ($pf) {
862 861
 			$data = $pf->makefeedtree();
863 862
 			$this->wrap(self::STATUS_OK, array("categories" => $data));
864 863
 		} else {
Please login to merge, or discard this patch.