| @@ -141,12 +141,12 @@ discard block | ||
| 141 | 141 | // prefix for links; needed for pages not in top dir | 
| 142 | 142 | $user, | 
| 143 | 143 | // logged-in user, if any | 
| 144 | - $fixed=false, | |
| 144 | + $fixed = false, | |
| 145 | 145 | // if true, navbar is fixed at top of page. | 
| 146 | 146 | // NOTE: if you do this, you must set a global var $fixed_navbar | 
| 147 | 147 | // to true at compile time | 
| 148 | 148 | // (it needs to be set when page_head() is called). | 
| 149 | - $inverse=false | |
| 149 | + $inverse = false | |
| 150 | 150 | // white on black? | 
| 151 | 151 |  ) { | 
| 152 | 152 | $master_url = master_url(); | 
| @@ -246,7 +246,7 @@ discard block | ||
| 246 | 246 | // output a panel. | 
| 247 | 247 | // $content_func is a function that generates the panel contents | 
| 248 | 248 | // | 
| 249 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { | |
| 249 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { | |
| 250 | 250 |      echo sprintf('<div class="panel %s"> | 
| 251 | 251 | ', $class | 
| 252 | 252 | ); | 
| @@ -273,7 +273,7 @@ discard block | ||
| 273 | 273 | // $left_width is the width of left column in 1/12 units. | 
| 274 | 274 | // $arg is passed to the functions. | 
| 275 | 275 | // | 
| 276 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { | |
| 276 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { | |
| 277 | 277 | echo ' | 
| 278 | 278 | <div class="container-fluid"> | 
| 279 | 279 | '; | 
| @@ -288,7 +288,7 @@ discard block | ||
| 288 | 288 | </div> | 
| 289 | 289 | '; | 
| 290 | 290 | } | 
| 291 | - $right_width = 12-$left_width; | |
| 291 | + $right_width = 12 - $left_width; | |
| 292 | 292 | echo ' | 
| 293 | 293 | <div class="row"> | 
| 294 | 294 | <div class="col-sm-'.$left_width.'"> | 
| @@ -312,7 +312,7 @@ discard block | ||
| 312 | 312 | // use extra = "name=x" | 
| 313 | 313 | // call forum_focus(x, foo) after defining the field | 
| 314 | 314 | // | 
| 315 | -function form_start($action, $method='get', $extra='') { | |
| 315 | +function form_start($action, $method = 'get', $extra = '') { | |
| 316 | 316 | echo sprintf( | 
| 317 | 317 | '<div class="container-fluid"> | 
| 318 | 318 | <form class="form-horizontal" method="%s" action="%s" %s>' | 
| @@ -346,7 +346,7 @@ discard block | ||
| 346 | 346 | // just the input field | 
| 347 | 347 | // | 
| 348 | 348 | function form_input_text_field( | 
| 349 | - $name, $value='', $type='text', $attrs='', $extra='' | |
| 349 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' | |
| 350 | 350 |  ) { | 
| 351 | 351 | return sprintf( | 
| 352 | 352 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', | 
| @@ -357,7 +357,7 @@ discard block | ||
| 357 | 357 | // the whole row | 
| 358 | 358 | // | 
| 359 | 359 | function form_input_text( | 
| 360 | - $label, $name, $value='', $type='text', $attrs='', $extra='' | |
| 360 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' | |
| 361 | 361 |  ) { | 
| 362 | 362 |      echo sprintf(' | 
| 363 | 363 | <div class="form-group"> | 
| @@ -385,7 +385,7 @@ discard block | ||
| 385 | 385 | ); | 
| 386 | 386 | } | 
| 387 | 387 | |
| 388 | -function form_input_textarea($label, $name, $value='', $nrows=4) { | |
| 388 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { | |
| 389 | 389 |      echo sprintf(' | 
| 390 | 390 | <div class="form-group"> | 
| 391 | 391 | <label align=right class="%s" for="%s">%s</label> | 
| @@ -402,7 +402,7 @@ discard block | ||
| 402 | 402 | // $items is either a string of <option> elements, | 
| 403 | 403 | // or an array of [value, name] pairs | 
| 404 | 404 | // | 
| 405 | -function form_select($label, $name, $items, $selected=null) { | |
| 405 | +function form_select($label, $name, $items, $selected = null) { | |
| 406 | 406 |      echo sprintf(' | 
| 407 | 407 | <div class="form-group"> | 
| 408 | 408 | <label align=right class="%s" for="%s">%s</label> | 
| @@ -415,7 +415,7 @@ discard block | ||
| 415 | 415 |          foreach ($items as $i) { | 
| 416 | 416 | echo sprintf( | 
| 417 | 417 | '<option %s value="%s">%s</option>', | 
| 418 | - ($i[0]==$selected)?'selected':'', | |
| 418 | + ($i[0] == $selected) ? 'selected' : '', | |
| 419 | 419 | $i[0], $i[1] | 
| 420 | 420 | ); | 
| 421 | 421 | } | 
| @@ -428,7 +428,7 @@ discard block | ||
| 428 | 428 | // same, for multiple select. | 
| 429 | 429 | // $selected, if non-null, is a list of selected values | 
| 430 | 430 | // | 
| 431 | -function form_select_multiple($label, $name, $items, $selected=null, $size=0) { | |
| 431 | +function form_select_multiple($label, $name, $items, $selected = null, $size = 0) { | |
| 432 | 432 |      echo sprintf(' | 
| 433 | 433 | <div class="form-group"> | 
| 434 | 434 | <label align=right class="%s" for="%s">%s</label> | 
| @@ -440,7 +440,7 @@ discard block | ||
| 440 | 440 |      foreach ($items as $i) { | 
| 441 | 441 | echo sprintf( | 
| 442 | 442 | '<option %s value="%s">%s</option>', | 
| 443 | - ($selected && in_array($i[0], $selected))?'selected':'', | |
| 443 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', | |
| 444 | 444 | $i[0], $i[1] | 
| 445 | 445 | ); | 
| 446 | 446 | } | 
| @@ -449,12 +449,12 @@ discard block | ||
| 449 | 449 | |
| 450 | 450 | // return a list of strings for checkbox items | 
| 451 | 451 | // | 
| 452 | -function checkbox_item_strings($items, $attrs='') { | |
| 452 | +function checkbox_item_strings($items, $attrs = '') { | |
| 453 | 453 | $x = []; | 
| 454 | 454 |      foreach ($items as $i) { | 
| 455 | 455 |          $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s | 
| 456 | 456 | ', | 
| 457 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] | |
| 457 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] | |
| 458 | 458 | ); | 
| 459 | 459 | } | 
| 460 | 460 | return $x; | 
| @@ -462,7 +462,7 @@ discard block | ||
| 462 | 462 | |
| 463 | 463 | // $items is list of (name, label, checked) | 
| 464 | 464 | // | 
| 465 | -function form_checkboxes($label, $items, $attrs='') { | |
| 465 | +function form_checkboxes($label, $items, $attrs = '') { | |
| 466 | 466 |      echo sprintf(' | 
| 467 | 467 | <div class="form-group"> | 
| 468 | 468 | <label align=right class="%s">%s</label> | 
| @@ -481,7 +481,7 @@ discard block | ||
| 481 | 481 | // | 
| 482 | 482 | function form_radio_buttons( | 
| 483 | 483 | $label, $name, $items, $selected, | 
| 484 | - $assign_ids=false // assign IDs to buttons based on names | |
| 484 | + $assign_ids = false // assign IDs to buttons based on names | |
| 485 | 485 |  ) { | 
| 486 | 486 |      echo sprintf(' | 
| 487 | 487 | <div class="form-group"> | 
| @@ -491,7 +491,7 @@ discard block | ||
| 491 | 491 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS | 
| 492 | 492 | ); | 
| 493 | 493 |      foreach ($items as $i) { | 
| 494 | - $checked = ($selected == $i[0])?"checked":""; | |
| 494 | + $checked = ($selected == $i[0]) ? "checked" : ""; | |
| 495 | 495 |          if ($assign_ids) { | 
| 496 | 496 |              $id = sprintf('id="%s_%s"', $name, $i[0]); | 
| 497 | 497 |          } else { | 
| @@ -529,7 +529,7 @@ discard block | ||
| 529 | 529 | '; | 
| 530 | 530 | } | 
| 531 | 531 | |
| 532 | -function form_submit($text, $attrs='') { | |
| 532 | +function form_submit($text, $attrs = '') { | |
| 533 | 533 | form_general( | 
| 534 | 534 | "", | 
| 535 | 535 | sprintf( | 
| @@ -539,7 +539,7 @@ discard block | ||
| 539 | 539 | ); | 
| 540 | 540 | } | 
| 541 | 541 | |
| 542 | -function form_checkbox($label, $name, $checked=false) { | |
| 542 | +function form_checkbox($label, $name, $checked = false) { | |
| 543 | 543 |      echo sprintf(' | 
| 544 | 544 | <div class="form-group"> | 
| 545 | 545 | <label align=right class="%s">%s</label> | 
| @@ -551,7 +551,7 @@ discard block | ||
| 551 | 551 | <input type="checkbox" name="%s" %s> | 
| 552 | 552 | </div> | 
| 553 | 553 | </div> | 
| 554 | - ', $name, $checked?"checked":"" | |
| 554 | + ', $name, $checked ? "checked" : "" | |
| 555 | 555 | ); | 
| 556 | 556 | } | 
| 557 | 557 | |
| @@ -579,7 +579,7 @@ discard block | ||
| 579 | 579 | // $selected is the list of selected values. | 
| 580 | 580 | // $extra is e.g. id=foo | 
| 581 | 581 | // | 
| 582 | -function form_select2_multi($label, $name, $items, $selected=null, $extra='') { | |
| 582 | +function form_select2_multi($label, $name, $items, $selected = null, $extra = '') { | |
| 583 | 583 |      echo sprintf(' | 
| 584 | 584 | <div class="form-group"> | 
| 585 | 585 | <label align=right class="%s" for="%s">%s</label> | 
| @@ -591,7 +591,7 @@ discard block | ||
| 591 | 591 |      foreach ($items as $i) { | 
| 592 | 592 | echo sprintf( | 
| 593 | 593 | '<option %s value="%s">%s</option>', | 
| 594 | - ($selected && in_array($i[0], $selected))?'selected':'', | |
| 594 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', | |
| 595 | 595 | $i[0], $i[1] | 
| 596 | 596 | ); | 
| 597 | 597 | } |