Passed
Pull Request — master (#4)
by
unknown
04:42
created
lib/MiniTemplator.class.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 * @access private
90 90
 */
91 91
 
92
-var $maxNestingLevel = 50;            // maximum number of block nestings
93
-var $maxInclTemplateSize = 1000000;   // maximum length of template string when including subtemplates
94
-var $template;                        // Template file data
95
-var $varTab;                          // variables table, array index is variable no
92
+var $maxNestingLevel = 50; // maximum number of block nestings
93
+var $maxInclTemplateSize = 1000000; // maximum length of template string when including subtemplates
94
+var $template; // Template file data
95
+var $varTab; // variables table, array index is variable no
96 96
 	// Fields:
97 97
 	//  varName                       // variable name
98 98
 	//  varValue                      // variable value
99
-var $varTabCnt;                       // no of entries used in VarTab
100
-var $varNameToNoMap;                  // maps variable names to variable numbers
101
-var $varRefTab;                       // variable references table
99
+var $varTabCnt; // no of entries used in VarTab
100
+var $varNameToNoMap; // maps variable names to variable numbers
101
+var $varRefTab; // variable references table
102 102
 	// Contains an entry for each variable reference in the template. Ordered by TemplatePos.
103 103
 	// Fields:
104 104
 	//  varNo                         // variable no
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	//  tPosEnd                       // template position of end of variable reference
107 107
 	//  blockNo                       // block no of the (innermost) block that contains this variable reference
108 108
 	//  blockVarNo                    // block variable no. Index into BlockInstTab.BlockVarTab
109
-var $varRefTabCnt;                    // no of entries used in VarRefTab
110
-var $blockTab;                        // Blocks table, array index is block no
109
+var $varRefTabCnt; // no of entries used in VarRefTab
110
+var $blockTab; // Blocks table, array index is block no
111 111
 	// Contains an entry for each block in the template. Ordered by TPosBegin.
112 112
 	// Fields:
113 113
 	//  blockName                     // block name
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	//  blockVarCnt                   // no of variables in block
127 127
 	//  blockVarNoToVarNoMap          // maps block variable numbers to variable numbers
128 128
 	//  firstVarRefNo                 // variable reference no of first variable of this block or -1
129
-var $blockTabCnt;                     // no of entries used in BlockTab
130
-var $blockNameToNoMap;                // maps block names to block numbers
129
+var $blockTabCnt; // no of entries used in BlockTab
130
+var $blockNameToNoMap; // maps block names to block numbers
131 131
 var $openBlocksTab;
132 132
 	// During parsing, this table contains the block numbers of the open parent blocks (nested outer blocks).
133 133
 	// Indexed by the block nesting level.
134
-var $blockInstTab;                    // block instances table
134
+var $blockInstTab; // block instances table
135 135
 	// This table contains an entry for each block instance that has been added.
136 136
 	// Indexed by BlockInstNo.
137 137
 	// Fields:
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 	//  nextBlockInstNo               // pointer to next instance of this block or -1
144 144
 	//     Forward chain for instances of same block.
145 145
 	//  blockVarTab                   // block instance variables
146
-var $blockInstTabCnt;                 // no of entries used in BlockInstTab
146
+var $blockInstTabCnt; // no of entries used in BlockInstTab
147 147
 
148
-var $currentNestingLevel;             // Current block nesting level during parsing.
149
-var $templateValid;                   // true if a valid template is prepared
150
-var $outputMode;                      // 0 = to PHP output stream, 1 = to file, 2 = to string
151
-var $outputFileHandle;                // file handle during writing of output file
152
-var $outputError;                     // true when an output error occurred
153
-var $outputString;                    // string buffer for the generated HTML page
148
+var $currentNestingLevel; // Current block nesting level during parsing.
149
+var $templateValid; // true if a valid template is prepared
150
+var $outputMode; // 0 = to PHP output stream, 1 = to file, 2 = to string
151
+var $outputFileHandle; // file handle during writing of output file
152
+var $outputError; // true when an output error occurred
153
+var $outputString; // string buffer for the generated HTML page
154 154
 
155 155
 /**#@-*/
156 156
 
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 * @return boolean  true on success, false on error.
172 172
 * @access public
173 173
 */
174
-function readTemplateFromFile ($fileName) {
175
-   if (!$this->readFileIntoString($fileName,$s)) {
176
-	  $this->triggerError ("Error while reading template file " . $fileName . ".");
174
+function readTemplateFromFile($fileName) {
175
+   if (!$this->readFileIntoString($fileName, $s)) {
176
+	  $this->triggerError("Error while reading template file ".$fileName.".");
177 177
 	  return false; }
178 178
    if (!$this->setTemplateString($s)) return false;
179 179
    return true; }
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 * @return boolean  true on success, false on error.
200 200
 * @access private
201 201
 */
202
-function loadSubtemplate ($subtemplateName, &$s) {
203
-   $subtemplateFileName = $this->combineFileSystemPath($this->subtemplateBasePath,$subtemplateName);
204
-   if (!$this->readFileIntoString($subtemplateFileName,$s)) {
205
-	  $this->triggerError ("Error while reading subtemplate file " . $subtemplateFileName . ".");
202
+function loadSubtemplate($subtemplateName, &$s) {
203
+   $subtemplateFileName = $this->combineFileSystemPath($this->subtemplateBasePath, $subtemplateName);
204
+   if (!$this->readFileIntoString($subtemplateFileName, $s)) {
205
+	  $this->triggerError("Error while reading subtemplate file ".$subtemplateFileName.".");
206 206
 	  return false; }
207 207
    return true; }
208 208
 
@@ -279,15 +279,15 @@  discard block
 block discarded – undo
279 279
 function parseTemplateCommands() {
280 280
    $p = 0;
281 281
    while (true) {
282
-	  $p0 = strpos($this->template,'<!--',$p);
282
+	  $p0 = strpos($this->template, '<!--', $p);
283 283
 	  if ($p0 === false) break;
284
-	  $p = strpos($this->template,'-->',$p0);
284
+	  $p = strpos($this->template, '-->', $p0);
285 285
 	  if ($p === false) {
286
-		 $this->triggerError ("Invalid HTML comment in template at offset $p0.");
286
+		 $this->triggerError("Invalid HTML comment in template at offset $p0.");
287 287
 		 return false; }
288 288
 	  $p += 3;
289
-	  $cmdL = substr($this->template,$p0+4,$p-$p0-7);
290
-	  if (!$this->processTemplateCommand($cmdL,$p0,$p,$resumeFromStart))
289
+	  $cmdL = substr($this->template, $p0 + 4, $p - $p0 - 7);
290
+	  if (!$this->processTemplateCommand($cmdL, $p0, $p, $resumeFromStart))
291 291
 		 return false;
292 292
 	  if ($resumeFromStart) $p = $p0; }
293 293
    return true; }
@@ -296,29 +296,29 @@  discard block
 block discarded – undo
296 296
 * @return boolean  true on success, false on error.
297 297
 * @access private
298 298
 */
299
-function processTemplateCommand ($cmdL, $cmdTPosBegin, $cmdTPosEnd, &$resumeFromStart) {
299
+function processTemplateCommand($cmdL, $cmdTPosBegin, $cmdTPosEnd, &$resumeFromStart) {
300 300
    $resumeFromStart = false;
301 301
    $p = 0;
302 302
    $cmd = '';
303
-   if (!$this->parseWord($cmdL,$p,$cmd)) return true;
304
-   $parms = substr($cmdL,$p);
303
+   if (!$this->parseWord($cmdL, $p, $cmd)) return true;
304
+   $parms = substr($cmdL, $p);
305 305
    switch (strtoupper($cmd)) {
306 306
 	  case '$BEGINBLOCK':
307
-		 if (!$this->processBeginBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
307
+		 if (!$this->processBeginBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd))
308 308
 			return false;
309 309
 		 break;
310 310
 	  case '$ENDBLOCK':
311
-		 if (!$this->processEndBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
311
+		 if (!$this->processEndBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd))
312 312
 			return false;
313 313
 		 break;
314 314
 	  case '$INCLUDE':
315
-		 if (!$this->processincludeCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
315
+		 if (!$this->processincludeCmd($parms, $cmdTPosBegin, $cmdTPosEnd))
316 316
 			return false;
317 317
 		 $resumeFromStart = true;
318 318
 		 break;
319 319
 	  default:
320 320
 		 if ($cmd{0} == '$' && !(strlen($cmd) >= 2 && $cmd{1} == '{')) {
321
-			$this->triggerError ("Unknown command \"$cmd\" in template at offset $cmdTPosBegin.");
321
+			$this->triggerError("Unknown command \"$cmd\" in template at offset $cmdTPosBegin.");
322 322
 			return false; }}
323 323
 	return true; }
324 324
 
@@ -327,24 +327,24 @@  discard block
 block discarded – undo
327 327
 * @return boolean  true on success, false on error.
328 328
 * @access private
329 329
 */
330
-function processBeginBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
330
+function processBeginBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd) {
331 331
    $p = 0;
332
-   if (!$this->parseWord($parms,$p,$blockName)) {
333
-	  $this->triggerError ("Missing block name in \$BeginBlock command in template at offset $cmdTPosBegin.");
332
+   if (!$this->parseWord($parms, $p, $blockName)) {
333
+	  $this->triggerError("Missing block name in \$BeginBlock command in template at offset $cmdTPosBegin.");
334 334
 	  return false; }
335
-   if (trim(substr($parms,$p)) != '') {
336
-	  $this->triggerError ("Extra parameter in \$BeginBlock command in template at offset $cmdTPosBegin.");
335
+   if (trim(substr($parms, $p)) != '') {
336
+	  $this->triggerError("Extra parameter in \$BeginBlock command in template at offset $cmdTPosBegin.");
337 337
 	  return false; }
338
-   $this->registerBlock ($blockName, $blockNo);
339
-   $btr =& $this->blockTab[$blockNo];
338
+   $this->registerBlock($blockName, $blockNo);
339
+   $btr = & $this->blockTab[$blockNo];
340 340
    $btr['tPosBegin'] = $cmdTPosBegin;
341 341
    $btr['tPosContentsBegin'] = $cmdTPosEnd;
342 342
    $btr['nestingLevel'] = $this->currentNestingLevel;
343
-   $btr['parentBlockNo'] = $this->openBlocksTab[$this->currentNestingLevel-1];
343
+   $btr['parentBlockNo'] = $this->openBlocksTab[$this->currentNestingLevel - 1];
344 344
    $this->openBlocksTab[$this->currentNestingLevel] = $blockNo;
345 345
    $this->currentNestingLevel += 1;
346 346
    if ($this->currentNestingLevel > $this->maxNestingLevel) {
347
-	  $this->triggerError ("Block nesting overflow in template at offset $cmdTPosBegin.");
347
+	  $this->triggerError("Block nesting overflow in template at offset $cmdTPosBegin.");
348 348
 	  return false; }
349 349
    return true; }
350 350
 
@@ -353,24 +353,24 @@  discard block
 block discarded – undo
353 353
 * @return boolean  true on success, false on error.
354 354
 * @access private
355 355
 */
356
-function processEndBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
356
+function processEndBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd) {
357 357
    $p = 0;
358
-   if (!$this->parseWord($parms,$p,$blockName)) {
359
-	  $this->triggerError ("Missing block name in \$EndBlock command in template at offset $cmdTPosBegin.");
358
+   if (!$this->parseWord($parms, $p, $blockName)) {
359
+	  $this->triggerError("Missing block name in \$EndBlock command in template at offset $cmdTPosBegin.");
360 360
 	  return false; }
361
-   if (trim(substr($parms,$p)) != '') {
362
-	  $this->triggerError ("Extra parameter in \$EndBlock command in template at offset $cmdTPosBegin.");
361
+   if (trim(substr($parms, $p)) != '') {
362
+	  $this->triggerError("Extra parameter in \$EndBlock command in template at offset $cmdTPosBegin.");
363 363
 	  return false; }
364
-   if (!$this->lookupBlockName($blockName,$blockNo)) {
365
-	  $this->triggerError ("Undefined block name \"$blockName\" in \$EndBlock command in template at offset $cmdTPosBegin.");
364
+   if (!$this->lookupBlockName($blockName, $blockNo)) {
365
+	  $this->triggerError("Undefined block name \"$blockName\" in \$EndBlock command in template at offset $cmdTPosBegin.");
366 366
 	  return false; }
367 367
    $this->currentNestingLevel -= 1;
368
-   $btr =& $this->blockTab[$blockNo];
368
+   $btr = & $this->blockTab[$blockNo];
369 369
    if (!$btr['definitionIsOpen']) {
370
-	  $this->triggerError ("Multiple \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
370
+	  $this->triggerError("Multiple \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
371 371
 	  return false; }
372 372
    if ($btr['nestingLevel'] != $this->currentNestingLevel) {
373
-	  $this->triggerError ("Block nesting level mismatch at \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
373
+	  $this->triggerError("Block nesting level mismatch at \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
374 374
 	  return false; }
375 375
    $btr['tPosContentsEnd'] = $cmdTPosBegin;
376 376
    $btr['tPosEnd'] = $cmdTPosEnd;
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
 */
383 383
 function registerBlock($blockName, &$blockNo) {
384 384
    $blockNo = $this->blockTabCnt++;
385
-   $btr =& $this->blockTab[$blockNo];
385
+   $btr = & $this->blockTab[$blockNo];
386 386
    $btr = array();
387 387
    $btr['blockName'] = $blockName;
388
-   if (!$this->lookupBlockName($blockName,$btr['nextWithSameName']))
388
+   if (!$this->lookupBlockName($blockName, $btr['nextWithSameName']))
389 389
 	  $btr['nextWithSameName'] = -1;
390 390
    $btr['definitionIsOpen'] = true;
391 391
    $btr['instances'] = 0;
@@ -402,13 +402,13 @@  discard block
 block discarded – undo
402 402
 * @access private
403 403
 */
404 404
 function checkBlockDefinitionsComplete() {
405
-   for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
406
-	  $btr =& $this->blockTab[$blockNo];
405
+   for ($blockNo = 0; $blockNo < $this->blockTabCnt; $blockNo++) {
406
+	  $btr = & $this->blockTab[$blockNo];
407 407
 	  if ($btr['definitionIsOpen']) {
408
-		 $this->triggerError ("Missing \$EndBlock command in template for block " . $btr['blockName'] . ".");
408
+		 $this->triggerError("Missing \$EndBlock command in template for block ".$btr['blockName'].".");
409 409
 		 return false; }}
410 410
    if ($this->currentNestingLevel != 0) {
411
-	  $this->triggerError ("Block nesting level error at end of template.");
411
+	  $this->triggerError("Block nesting level error at end of template.");
412 412
 	  return false; }
413 413
    return true; }
414 414
 
@@ -417,29 +417,29 @@  discard block
 block discarded – undo
417 417
 * @return boolean  true on success, false on error.
418 418
 * @access private
419 419
 */
420
-function processIncludeCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
420
+function processIncludeCmd($parms, $cmdTPosBegin, $cmdTPosEnd) {
421 421
    $p = 0;
422
-   if (!$this->parseWordOrQuotedString($parms,$p,$subtemplateName)) {
423
-	  $this->triggerError ("Missing or invalid subtemplate name in \$Include command in template at offset $cmdTPosBegin.");
422
+   if (!$this->parseWordOrQuotedString($parms, $p, $subtemplateName)) {
423
+	  $this->triggerError("Missing or invalid subtemplate name in \$Include command in template at offset $cmdTPosBegin.");
424 424
 	  return false; }
425
-   if (trim(substr($parms,$p)) != '') {
426
-	  $this->triggerError ("Extra parameter in \$include command in template at offset $cmdTPosBegin.");
425
+   if (trim(substr($parms, $p)) != '') {
426
+	  $this->triggerError("Extra parameter in \$include command in template at offset $cmdTPosBegin.");
427 427
 	  return false; }
428
-   return $this->insertSubtemplate($subtemplateName,$cmdTPosBegin,$cmdTPosEnd); }
428
+   return $this->insertSubtemplate($subtemplateName, $cmdTPosBegin, $cmdTPosEnd); }
429 429
 
430 430
 /**
431 431
 * Processes the $Include command.
432 432
 * @return boolean  true on success, false on error.
433 433
 * @access private
434 434
 */
435
-function insertSubtemplate ($subtemplateName, $tPos1, $tPos2) {
435
+function insertSubtemplate($subtemplateName, $tPos1, $tPos2) {
436 436
    if (strlen($this->template) > $this->maxInclTemplateSize) {
437
-	  $this->triggerError ("Subtemplate include aborted because the internal template string is longer than $this->maxInclTemplateSize characters.");
437
+	  $this->triggerError("Subtemplate include aborted because the internal template string is longer than $this->maxInclTemplateSize characters.");
438 438
 	  return false; }
439
-   if (!$this->loadSubtemplate($subtemplateName,$subtemplate)) return false;
439
+   if (!$this->loadSubtemplate($subtemplateName, $subtemplate)) return false;
440 440
    // (Copying the template to insert a subtemplate is a bit slow. In a future implementation of MiniTemplator,
441 441
    // a table could be used that contains references to the string fragments.)
442
-   $this->template = substr($this->template,0,$tPos1) . $subtemplate . substr($this->template,$tPos2);
442
+   $this->template = substr($this->template, 0, $tPos1).$subtemplate.substr($this->template, $tPos2);
443 443
    return true; }
444 444
 
445 445
 /**
@@ -455,24 +455,24 @@  discard block
 block discarded – undo
455 455
 	  $p0 = $p;
456 456
 	  $p = strpos($this->template, '}', $p);
457 457
 	  if ($p === false) {
458
-		 $this->triggerError ("Invalid variable reference in template at offset $p0.");
458
+		 $this->triggerError("Invalid variable reference in template at offset $p0.");
459 459
 		 return false; }
460 460
 	  $p += 1;
461
-	  $varName = trim(substr($this->template, $p0+2, $p-$p0-3));
461
+	  $varName = trim(substr($this->template, $p0 + 2, $p - $p0 - 3));
462 462
 	  if (strlen($varName) == 0) {
463
-		 $this->triggerError ("Empty variable name in template at offset $p0.");
463
+		 $this->triggerError("Empty variable name in template at offset $p0.");
464 464
 		 return false; }
465
-	  $this->registerVariableReference ($varName, $p0, $p); }
465
+	  $this->registerVariableReference($varName, $p0, $p); }
466 466
    return true; }
467 467
 
468 468
 /**
469 469
 * @access private
470 470
 */
471
-function registerVariableReference ($varName, $tPosBegin, $tPosEnd) {
472
-   if (!$this->lookupVariableName($varName,$varNo))
473
-	  $this->registerVariable($varName,$varNo);
471
+function registerVariableReference($varName, $tPosBegin, $tPosEnd) {
472
+   if (!$this->lookupVariableName($varName, $varNo))
473
+	  $this->registerVariable($varName, $varNo);
474 474
    $varRefNo = $this->varRefTabCnt++;
475
-   $vrtr =& $this->varRefTab[$varRefNo];
475
+   $vrtr = & $this->varRefTab[$varRefNo];
476 476
    $vrtr = array();
477 477
    $vrtr['tPosBegin'] = $tPosBegin;
478 478
    $vrtr['tPosEnd'] = $tPosEnd;
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
    $activeBlockNo = 0;
499 499
    $nextBlockNo = 1;
500 500
    while ($varRefNo < $this->varRefTabCnt) {
501
-	  $vrtr =& $this->varRefTab[$varRefNo];
501
+	  $vrtr = & $this->varRefTab[$varRefNo];
502 502
 	  $varRefTPos = $vrtr['tPosBegin'];
503 503
 	  $varNo = $vrtr['varNo'];
504 504
 	  if ($varRefTPos >= $this->blockTab[$activeBlockNo]['tPosEnd']) {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			$activeBlockNo = $nextBlockNo;
510 510
 			$nextBlockNo += 1;
511 511
 			continue; }}
512
-	  $btr =& $this->blockTab[$activeBlockNo];
512
+	  $btr = & $this->blockTab[$activeBlockNo];
513 513
 	  if ($varRefTPos < $btr['tPosBegin'])
514 514
 		 $this->programLogicError(1);
515 515
 	  $blockVarNo = $btr['blockVarCnt']++;
@@ -531,10 +531,10 @@  discard block
 block discarded – undo
531 531
 * @access public
532 532
 */
533 533
 function reset() {
534
-   for ($varNo=0; $varNo<$this->varTabCnt; $varNo++)
534
+   for ($varNo = 0; $varNo < $this->varTabCnt; $varNo++)
535 535
 	  $this->varTab[$varNo]['varValue'] = '';
536
-   for ($blockNo=0; $blockNo<$this->blockTabCnt; $blockNo++) {
537
-	  $btr =& $this->blockTab[$blockNo];
536
+   for ($blockNo = 0; $blockNo < $this->blockTabCnt; $blockNo++) {
537
+	  $btr = & $this->blockTab[$blockNo];
538 538
 	  $btr['instances'] = 0;
539 539
 	  $btr['firstBlockInstNo'] = -1;
540 540
 	  $btr['lastBlockInstNo'] = -1; }
@@ -556,11 +556,11 @@  discard block
 block discarded – undo
556 556
 *    $isOptional is false).
557 557
 * @access public
558 558
 */
559
-function setVariable ($variableName, $variableValue, $isOptional=false) {
560
-   if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
561
-   if (!$this->lookupVariableName($variableName,$varNo)) {
559
+function setVariable($variableName, $variableValue, $isOptional = false) {
560
+   if (!$this->templateValid) {$this->triggerError("Template not valid."); return false; }
561
+   if (!$this->lookupVariableName($variableName, $varNo)) {
562 562
 	  if ($isOptional) return true;
563
-	  $this->triggerError ("Variable \"$variableName\" not defined in template.");
563
+	  $this->triggerError("Variable \"$variableName\" not defined in template.");
564 564
 	  return false; }
565 565
    $this->varTab[$varNo]['varValue'] = $variableValue;
566 566
    return true; }
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 * @access public
612 612
 */
613 613
 function addBlock($blockName) {
614
-   if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
615
-   if (!$this->lookupBlockName($blockName,$blockNo)) {
616
-	  $this->triggerError ("Block \"$blockName\" not defined in template.");
614
+   if (!$this->templateValid) {$this->triggerError("Template not valid."); return false; }
615
+   if (!$this->lookupBlockName($blockName, $blockNo)) {
616
+	  $this->triggerError("Block \"$blockName\" not defined in template.");
617 617
 	  return false; }
618 618
    while ($blockNo != -1) {
619 619
 	  $this->addBlockByNo($blockNo);
@@ -644,14 +644,14 @@  discard block
 block discarded – undo
644 644
    $bitr['nextBlockInstNo'] = -1;
645 645
    $bitr['blockVarTab'] = array();
646 646
    // copy instance variables for this block
647
-   for ($blockVarNo=0; $blockVarNo<$blockVarCnt; $blockVarNo++) {
647
+   for ($blockVarNo = 0; $blockVarNo < $blockVarCnt; $blockVarNo++) {
648 648
 	  $varNo = $btr['blockVarNoToVarNoMap'][$blockVarNo];
649 649
 	  $bitr['blockVarTab'][$blockVarNo] = $this->varTab[$varNo]['varValue']; }}
650 650
 
651 651
 /**
652 652
 * @access private
653 653
 */
654
-function registerBlockInstance (&$blockInstNo) {
654
+function registerBlockInstance(&$blockInstNo) {
655 655
    $blockInstNo = $this->blockInstTabCnt++; }
656 656
 
657 657
 /**
@@ -716,14 +716,14 @@  discard block
 block discarded – undo
716 716
 * @return boolean  true on success, false on error.
717 717
 */
718 718
 function generateOutputPage() {
719
-   if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
719
+   if (!$this->templateValid) {$this->triggerError("Template not valid."); return false; }
720 720
    if ($this->blockTab[0]['instances'] == 0)
721
-	  $this->addBlockByNo (0);        // add main block
722
-   for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
723
-	   $btr =& $this->blockTab[$blockNo];
721
+	  $this->addBlockByNo(0); // add main block
722
+   for ($blockNo = 0; $blockNo < $this->blockTabCnt; $blockNo++) {
723
+	   $btr = & $this->blockTab[$blockNo];
724 724
 	   $btr['currBlockInstNo'] = $btr['firstBlockInstNo']; }
725 725
    $this->outputError = false;
726
-   $this->writeBlockInstances (0, -1);
726
+   $this->writeBlockInstances(0, -1);
727 727
    if ($this->outputError) return false;
728 728
    return true; }
729 729
 
@@ -733,33 +733,33 @@  discard block
 block discarded – undo
733 733
 * Called recursively.
734 734
 * @access private
735 735
 */
736
-function writeBlockInstances ($blockNo, $parentInstLevel) {
737
-   $btr =& $this->blockTab[$blockNo];
736
+function writeBlockInstances($blockNo, $parentInstLevel) {
737
+   $btr = & $this->blockTab[$blockNo];
738 738
    while (!$this->outputError) {
739 739
 	  $blockInstNo = $btr['currBlockInstNo'];
740 740
 	  if ($blockInstNo == -1) break;
741
-	  $bitr =& $this->blockInstTab[$blockInstNo];
741
+	  $bitr = & $this->blockInstTab[$blockInstNo];
742 742
 	  if ($bitr['parentInstLevel'] < $parentInstLevel)
743
-		 $this->programLogicError (2);
743
+		 $this->programLogicError(2);
744 744
 	  if ($bitr['parentInstLevel'] > $parentInstLevel) break;
745
-	  $this->writeBlockInstance ($blockInstNo);
745
+	  $this->writeBlockInstance($blockInstNo);
746 746
 	  $btr['currBlockInstNo'] = $bitr['nextBlockInstNo']; }}
747 747
 
748 748
 /**
749 749
 * @access private
750 750
 */
751 751
 function writeBlockInstance($blockInstNo) {
752
-   $bitr =& $this->blockInstTab[$blockInstNo];
752
+   $bitr = & $this->blockInstTab[$blockInstNo];
753 753
    $blockNo = $bitr['blockNo'];
754
-   $btr =& $this->blockTab[$blockNo];
754
+   $btr = & $this->blockTab[$blockNo];
755 755
    $tPos = $btr['tPosContentsBegin'];
756 756
    $subBlockNo = $blockNo + 1;
757 757
    $varRefNo = $btr['firstVarRefNo'];
758 758
    while (!$this->outputError) {
759 759
 	  $tPos2 = $btr['tPosContentsEnd'];
760
-	  $kind = 0;                                // assume end-of-block
760
+	  $kind = 0; // assume end-of-block
761 761
 	  if ($varRefNo != -1 && $varRefNo < $this->varRefTabCnt) {  // check for variable reference
762
-		 $vrtr =& $this->varRefTab[$varRefNo];
762
+		 $vrtr = & $this->varRefTab[$varRefNo];
763 763
 		 if ($vrtr['tPosBegin'] < $tPos) {
764 764
 			$varRefNo += 1;
765 765
 			continue; }
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 			$tPos2 = $vrtr['tPosBegin'];
768 768
 			$kind = 1; }}
769 769
 	  if ($subBlockNo < $this->blockTabCnt) {   // check for subblock
770
-		 $subBtr =& $this->blockTab[$subBlockNo];
770
+		 $subBtr = & $this->blockTab[$subBlockNo];
771 771
 		 if ($subBtr['tPosBegin'] < $tPos) {
772 772
 			$subBlockNo += 1;
773 773
 			continue; }
@@ -775,24 +775,24 @@  discard block
 block discarded – undo
775 775
 			$tPos2 = $subBtr['tPosBegin'];
776 776
 			$kind = 2; }}
777 777
 	  if ($tPos2 > $tPos)
778
-		 $this->writeString (substr($this->template,$tPos,$tPos2-$tPos));
778
+		 $this->writeString(substr($this->template, $tPos, $tPos2 - $tPos));
779 779
 	  switch ($kind) {
780 780
 		 case 0:         // end of block
781 781
 			return;
782 782
 		 case 1:         // variable
783
-			$vrtr =& $this->varRefTab[$varRefNo];
783
+			$vrtr = & $this->varRefTab[$varRefNo];
784 784
 			if ($vrtr['blockNo'] != $blockNo)
785
-			   $this->programLogicError (4);
785
+			   $this->programLogicError(4);
786 786
 			$variableValue = $bitr['blockVarTab'][$vrtr['blockVarNo']];
787
-			$this->writeString ($variableValue);
787
+			$this->writeString($variableValue);
788 788
 			$tPos = $vrtr['tPosEnd'];
789 789
 			$varRefNo += 1;
790 790
 			break;
791 791
 		 case 2:         // sub block
792
-			$subBtr =& $this->blockTab[$subBlockNo];
792
+			$subBtr = & $this->blockTab[$subBlockNo];
793 793
 			if ($subBtr['parentBlockNo'] != $blockNo)
794
-			   $this->programLogicError (3);
795
-			$this->writeBlockInstances ($subBlockNo, $bitr['instanceLevel']);  // recursive call
794
+			   $this->programLogicError(3);
795
+			$this->writeBlockInstances($subBlockNo, $bitr['instanceLevel']); // recursive call
796 796
 			$tPos = $subBtr['tPosEnd'];
797 797
 			$subBlockNo += 1;
798 798
 			break; }}}
@@ -848,17 +848,17 @@  discard block
 block discarded – undo
848 848
 * @return boolean  true on success, false on error.
849 849
 * @access private
850 850
 */
851
-function readFileIntoString ($fileName, &$s) {
852
-   if (function_exists('version_compare') && version_compare(phpversion(),"4.3.0",">=")) {
851
+function readFileIntoString($fileName, &$s) {
852
+   if (function_exists('version_compare') && version_compare(phpversion(), "4.3.0", ">=")) {
853 853
 	  $s = file_get_contents($fileName);
854 854
 	  if ($s === false) return false;
855 855
 	  return true; }
856
-   $fh = fopen($fileName,"rb");
856
+   $fh = fopen($fileName, "rb");
857 857
    if ($fh === false) return false;
858 858
    $fileSize = filesize($fileName);
859
-   if ($fileSize === false) {fclose ($fh); return false; }
860
-   $s = fread($fh,$fileSize);
861
-   fclose ($fh);
859
+   if ($fileSize === false) {fclose($fh); return false; }
860
+   $s = fread($fh, $fileSize);
861
+   fclose($fh);
862 862
    if (strlen($s) != $fileSize) return false;
863 863
    return true; }
864 864
 
@@ -901,39 +901,39 @@  discard block
 block discarded – undo
901 901
 * @access private
902 902
 * @return boolean  true on success, false on error.
903 903
 */
904
-function parseWordOrQuotedString ($s, &$p, &$w) {
904
+function parseWordOrQuotedString($s, &$p, &$w) {
905 905
    $sLen = strlen($s);
906 906
    while ($p < $sLen && ord($s{$p}) <= 32) $p++;
907 907
    if ($p >= $sLen) return false;
908
-   if (substr($s,$p,1) == '"')
909
-	  return $this->parseQuotedString($s,$p,$w);
908
+   if (substr($s, $p, 1) == '"')
909
+	  return $this->parseQuotedString($s, $p, $w);
910 910
 	else
911
-	  return $this->parseWord($s,$p,$w); }
911
+	  return $this->parseWord($s, $p, $w); }
912 912
 
913 913
 /**
914 914
 * Combine two file system paths.
915 915
 * @access private
916 916
 */
917
-function combineFileSystemPath ($path1, $path2) {
917
+function combineFileSystemPath($path1, $path2) {
918 918
    if ($path1 == '' || $path2 == '') return $path2;
919 919
    $s = $path1;
920
-   if (substr($s,-1) != '\\' && substr($s,-1) != '/') $s = $s . "/";
921
-   if (substr($path2,0,1) == '\\' || substr($path2,0,1) == '/')
922
-	  $s = $s . substr($path2,1);
920
+   if (substr($s, -1) != '\\' && substr($s, -1) != '/') $s = $s."/";
921
+   if (substr($path2, 0, 1) == '\\' || substr($path2, 0, 1) == '/')
922
+	  $s = $s.substr($path2, 1);
923 923
 	else
924
-	  $s = $s . $path2;
924
+	  $s = $s.$path2;
925 925
    return $s; }
926 926
 
927 927
 /**
928 928
 * @access private
929 929
 */
930
-function triggerError ($msg) {
931
-   trigger_error ("MiniTemplator error: $msg", E_USER_ERROR); }
930
+function triggerError($msg) {
931
+   trigger_error("MiniTemplator error: $msg", E_USER_ERROR); }
932 932
 
933 933
 /**
934 934
 * @access private
935 935
 */
936
-function programLogicError ($errorId) {
936
+function programLogicError($errorId) {
937 937
    die ("MiniTemplator: Program logic error $errorId.\n"); }
938 938
 
939 939
 }
Please login to merge, or discard this patch.
lib/accept-to-gettext.php 1 patch
Spacing   +47 added lines, -49 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
   }
Please login to merge, or discard this patch.
classes/api.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -196,13 +196,13 @@
 block discarded – undo
196 196
 				$feed_id = (int) $feed_id;
197 197
 			}
198 198
 
199
-			$limit = (int)clean($_REQUEST["limit"]);
199
+			$limit = (int) clean($_REQUEST["limit"]);
200 200
 
201 201
 			if (!$limit || $limit >= 200) {
202 202
 				$limit = 200;
203 203
 			}
204 204
 
205
-			$offset = (int)clean($_REQUEST["skip"]);
205
+			$offset = (int) clean($_REQUEST["skip"]);
206 206
 			$filter = clean($_REQUEST["filter"]);
207 207
 			$is_cat = API::param_to_bool(clean($_REQUEST["is_cat"]));
208 208
 			$show_excerpt = API::param_to_bool(clean($_REQUEST["show_excerpt"]));
Please login to merge, or discard this patch.
classes/handler/public.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@
 block discarded – undo
391 391
 			list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]);
392 392
 
393 393
 			if ($og_image) {
394
-				$rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>";
394
+				$rv .= "<meta property='og:image' content=\"".htmlspecialchars($og_image)."\"/>";
395 395
 			}
396 396
 
397 397
 			$rv .= "<body class='flat ttrss_utility ttrss_zoom'>";
Please login to merge, or discard this patch.
classes/feeds.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
 				if (!get_pref("CDM_EXPANDED")) {
334 334
 					$line["cdm_excerpt"] = "<span class='collapse'>
335 335
                         <i class='material-icons' onclick='return Article.cdmUnsetActive(event)'
336
-                            title=\"" . __("Collapse article") . "\">remove_circle</i></span>";
336
+                            title=\"" . __("Collapse article")."\">remove_circle</i></span>";
337 337
 
338 338
 					if (get_pref('SHOW_CONTENT_PREVIEW')) {
339
-						$line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>";
339
+						$line["cdm_excerpt"] .= "<span class='excerpt'>".$line["content_preview"]."</span>";
340 340
 					}
341 341
 				}
342 342
 
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 					$ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]);
351 351
 
352 352
 					if ($tmp_line = $ofgh->fetch()) {
353
-						$line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ];
353
+						$line["orig_feed"] = [$tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"]];
354 354
 					}
355 355
 				}
356 356
 
357
-				$line["updated_long"] = make_local_datetime($line["updated"],true);
357
+				$line["updated_long"] = make_local_datetime($line["updated"], true);
358 358
 				$line["updated"] = make_local_datetime($line["updated"], false, false, false, true);
359 359
 
360 360
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 				}
390 390
 
391 391
 				if (isset($rgba_cache[$feed_id])) {
392
-					$line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)';
392
+					$line['feed_bg_color'] = 'rgba('.implode(",", $rgba_cache[$feed_id]).',0.3)';
393 393
 				}
394 394
 
395 395
 				/* we don't need those */
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 					$icon = self::getIconFile($id);
1255 1255
 
1256 1256
 					if ($icon && file_exists($icon)) {
1257
-						return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon);
1257
+						return ICONS_URL."/".basename($icon)."?".filemtime($icon);
1258 1258
 					}
1259 1259
 				}
1260 1260
 		}
@@ -1951,9 +1951,9 @@  discard block
 block discarded – undo
1951 1951
 	}
1952 1952
 
1953 1953
 	function color_of($name) {
1954
-		$colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b",
1955
-			"#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416",
1956
-			"#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ];
1954
+		$colormap = ["#1cd7d7", "#d91111", "#1212d7", "#8e16e5", "#7b7b7b",
1955
+			"#39f110", "#0bbea6", "#ec0e0e", "#1534f2", "#b9e416",
1956
+			"#479af2", "#f36b14", "#10c7e9", "#1e8fe7", "#e22727"];
1957 1957
 
1958 1958
 		$sum = 0;
1959 1959
 
@@ -2260,7 +2260,7 @@  discard block
 block discarded – undo
2260 2260
 			case "title":
2261 2261
 				if ($commandpair[1]) {
2262 2262
 					array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ".
2263
-						$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))");
2263
+						$pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))");
2264 2264
 				} else {
2265 2265
 					array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2266 2266
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
@@ -2270,7 +2270,7 @@  discard block
 block discarded – undo
2270 2270
 			case "author":
2271 2271
 				if ($commandpair[1]) {
2272 2272
 					array_push($query_keywords, "($not (LOWER(author) LIKE ".
2273
-						$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2273
+						$pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))");
2274 2274
 				} else {
2275 2275
 					array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2276 2276
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
@@ -2285,7 +2285,7 @@  discard block
 block discarded – undo
2285 2285
 						array_push($query_keywords, "($not (note IS NULL OR note = ''))");
2286 2286
 					else
2287 2287
 						array_push($query_keywords, "($not (LOWER(note) LIKE ".
2288
-							$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2288
+							$pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))");
2289 2289
 				} else {
2290 2290
 					array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2291 2291
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
Please login to merge, or discard this patch.
classes/db.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@
 block discarded – undo
31 31
 			$this->adapter = new Db_Pgsql();
32 32
 			break;
33 33
 		default:
34
-			die("Unknown DB_TYPE: " . DB_TYPE);
34
+			die("Unknown DB_TYPE: ".DB_TYPE);
35 35
 		}
36 36
 
37 37
 		if (!$this->adapter) {
38
-			print("Error initializing database adapter for " . DB_TYPE);
38
+			print("Error initializing database adapter for ".DB_TYPE);
39 39
 			exit(100);
40 40
 		}
41 41
 
42 42
 		$this->link = $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, defined('DB_PORT') ? DB_PORT : "");
43 43
 
44 44
 		if (!$this->link) {
45
-			print("Error connecting through adapter: " . $this->adapter->last_error());
45
+			print("Error connecting through adapter: ".$this->adapter->last_error());
46 46
 			exit(101);
47 47
 		}
48 48
 
Please login to merge, or discard this patch.
classes/pref/feeds.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1072,57 +1072,57 @@  discard block
 block discarded – undo
1072 1072
 
1073 1073
 				switch ($k) {
1074 1074
 				case "title":
1075
-					$qpart = "title = " . $this->pdo->quote($feed_title);
1075
+					$qpart = "title = ".$this->pdo->quote($feed_title);
1076 1076
 					break;
1077 1077
 
1078 1078
 				case "feed_url":
1079
-					$qpart = "feed_url = " . $this->pdo->quote($feed_url);
1079
+					$qpart = "feed_url = ".$this->pdo->quote($feed_url);
1080 1080
 					break;
1081 1081
 
1082 1082
 				case "update_interval":
1083
-					$qpart = "update_interval = " . $this->pdo->quote($upd_intl);
1083
+					$qpart = "update_interval = ".$this->pdo->quote($upd_intl);
1084 1084
 					break;
1085 1085
 
1086 1086
 				case "purge_interval":
1087
-					$qpart = "purge_interval =" . $this->pdo->quote($purge_intl);
1087
+					$qpart = "purge_interval =".$this->pdo->quote($purge_intl);
1088 1088
 					break;
1089 1089
 
1090 1090
 				case "auth_login":
1091
-					$qpart = "auth_login = " . $this->pdo->quote($auth_login);
1091
+					$qpart = "auth_login = ".$this->pdo->quote($auth_login);
1092 1092
 					break;
1093 1093
 
1094 1094
 				case "auth_pass":
1095
-					$qpart = "auth_pass =" . $this->pdo->quote($auth_pass). ", auth_pass_encrypted = false";
1095
+					$qpart = "auth_pass =".$this->pdo->quote($auth_pass).", auth_pass_encrypted = false";
1096 1096
 					break;
1097 1097
 
1098 1098
 				case "private":
1099
-					$qpart = "private = " . $this->pdo->quote($private);
1099
+					$qpart = "private = ".$this->pdo->quote($private);
1100 1100
 					break;
1101 1101
 
1102 1102
 				case "include_in_digest":
1103
-					$qpart = "include_in_digest = " . $this->pdo->quote($include_in_digest);
1103
+					$qpart = "include_in_digest = ".$this->pdo->quote($include_in_digest);
1104 1104
 					break;
1105 1105
 
1106 1106
 				case "always_display_enclosures":
1107
-					$qpart = "always_display_enclosures = " . $this->pdo->quote($always_display_enclosures);
1107
+					$qpart = "always_display_enclosures = ".$this->pdo->quote($always_display_enclosures);
1108 1108
 					break;
1109 1109
 
1110 1110
 				case "mark_unread_on_update":
1111
-					$qpart = "mark_unread_on_update = " . $this->pdo->quote($mark_unread_on_update);
1111
+					$qpart = "mark_unread_on_update = ".$this->pdo->quote($mark_unread_on_update);
1112 1112
 					break;
1113 1113
 
1114 1114
 				case "cache_images":
1115
-					$qpart = "cache_images = " . $this->pdo->quote($cache_images);
1115
+					$qpart = "cache_images = ".$this->pdo->quote($cache_images);
1116 1116
 					break;
1117 1117
 
1118 1118
 				case "hide_images":
1119
-					$qpart = "hide_images = " . $this->pdo->quote($hide_images);
1119
+					$qpart = "hide_images = ".$this->pdo->quote($hide_images);
1120 1120
 					break;
1121 1121
 
1122 1122
 				case "cat_id":
1123 1123
 					if (get_pref('ENABLE_FEED_CATS')) {
1124 1124
 						if ($cat_id) {
1125
-							$qpart = "cat_id = " . $this->pdo->quote($cat_id);
1125
+							$qpart = "cat_id = ".$this->pdo->quote($cat_id);
1126 1126
 						} else {
1127 1127
 							$qpart = 'cat_id = NULL';
1128 1128
 						}
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
 					break;
1134 1134
 
1135 1135
 				case "feed_language":
1136
-					$qpart = "feed_language = " . $this->pdo->quote($feed_language);
1136
+					$qpart = "feed_language = ".$this->pdo->quote($feed_language);
1137 1137
 					break;
1138 1138
 
1139 1139
 				}
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
 
1580 1580
 	public static function remove_feed($id, $owner_uid) {
1581 1581
 		foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) {
1582
-			if (! $p->hook_unsubscribe_feed($id, $owner_uid)) {
1582
+			if (!$p->hook_unsubscribe_feed($id, $owner_uid)) {
1583 1583
 				user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING);
1584 1584
 				return;
1585 1585
 			}
Please login to merge, or discard this patch.
classes/pref/filters.php 1 patch
Spacing   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 
82 82
 					if (strpos($feed_id, "CAT:") === 0) {
83 83
 						$cat_id = (int) substr($feed_id, 4);
84
-						array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id));
84
+						array_push($scope_inner_qparts, "cat_id = ".$this->pdo->quote($cat_id));
85 85
 					} else if ($feed_id > 0) {
86
-						array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id));
86
+						array_push($scope_inner_qparts, "feed_id = ".$this->pdo->quote($feed_id));
87 87
 					}
88 88
 				}
89 89
 
90 90
 				if (count($scope_inner_qparts) > 0) {
91
-					array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")");
91
+					array_push($scope_qparts, "(".implode(" OR ", $scope_inner_qparts).")");
92 92
 				}
93 93
 
94 94
 				array_push($filter["rules"], $rule);
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 				foreach ($feeds as $feed_id) {
207 207
 
208 208
 					if (strpos($feed_id, "CAT:") === 0) {
209
-						$feed_id = (int)substr($feed_id, 4);
209
+						$feed_id = (int) substr($feed_id, 4);
210 210
 						array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id));
211 211
 					} else {
212 212
 						if ($feed_id)
213
-							array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
213
+							array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id));
214 214
 						else
215 215
 							array_push($feeds_fmt, __("All feeds"));
216 216
 					}
@@ -221,8 +221,7 @@  discard block
 block discarded – undo
221 221
 			} else {
222 222
 
223 223
 				$where = $line["cat_filter"] ?
224
-					Feeds::getCategoryTitle($line["cat_id"]) :
225
-					($line["feed_id"] ?
224
+					Feeds::getCategoryTitle($line["cat_id"]) : ($line["feed_id"] ?
226 225
 						Feeds::getFeedTitle($line["feed_id"]) : __("All feeds"));
227 226
 			}
228 227
 
@@ -537,11 +536,11 @@  discard block
 block discarded – undo
537 536
 		foreach ($feeds as $feed_id) {
538 537
 
539 538
 			if (strpos($feed_id, "CAT:") === 0) {
540
-				$feed_id = (int)substr($feed_id, 4);
539
+				$feed_id = (int) substr($feed_id, 4);
541 540
 				array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id));
542 541
 			} else {
543 542
 				if ($feed_id)
544
-					array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
543
+					array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id));
545 544
 				else
546 545
 					array_push($feeds_fmt, __("All feeds"));
547 546
 			}
Please login to merge, or discard this patch.
classes/dlg.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
 			$tags[$line["tag_name"]] = $line["count"];
109 109
 		}
110 110
 
111
-		if(count($tags) == 0 ){ return; }
111
+		if (count($tags) == 0) { return; }
112 112
 
113 113
 		ksort($tags);
114 114
 
Please login to merge, or discard this patch.