@@ -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 | global $master_url; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | // output a panel. |
| 215 | 215 | // $content_func is a function that generates the panel contents |
| 216 | 216 | // |
| 217 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
| 217 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
| 218 | 218 | echo sprintf('<div class="panel %s"> |
| 219 | 219 | ', $class |
| 220 | 220 | ); |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | // are functions that generate the top, left, and right content |
| 241 | 241 | // $left_width is the width of left column in 1/12 units. |
| 242 | 242 | // |
| 243 | -function grid($top_func, $left_func, $right_func, $left_width=6) { |
|
| 243 | +function grid($top_func, $left_func, $right_func, $left_width = 6) { |
|
| 244 | 244 | echo ' |
| 245 | 245 | <div class="container-fluid"> |
| 246 | 246 | '; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | </div> |
| 256 | 256 | '; |
| 257 | 257 | } |
| 258 | - $right_width = 12-$left_width; |
|
| 258 | + $right_width = 12 - $left_width; |
|
| 259 | 259 | echo ' |
| 260 | 260 | <div class="row"> |
| 261 | 261 | <div class="col-sm-'.$left_width.'"> |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | // use extra = "name=x" |
| 280 | 280 | // call forum_focus(x, foo) after defining the field |
| 281 | 281 | // |
| 282 | -function form_start($action, $method='get', $extra='') { |
|
| 282 | +function form_start($action, $method = 'get', $extra = '') { |
|
| 283 | 283 | echo sprintf( |
| 284 | 284 | '<div class="container-fluid"> |
| 285 | 285 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | // just the input field |
| 312 | 312 | // |
| 313 | 313 | function form_input_text_field( |
| 314 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
| 314 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 315 | 315 | ) { |
| 316 | 316 | return sprintf( |
| 317 | 317 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | // the whole row |
| 323 | 323 | // |
| 324 | 324 | function form_input_text( |
| 325 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
| 325 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 326 | 326 | ) { |
| 327 | 327 | echo sprintf(' |
| 328 | 328 | <div class="form-group"> |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | ); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
| 353 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
| 354 | 354 | echo sprintf(' |
| 355 | 355 | <div class="form-group"> |
| 356 | 356 | <label align=right class="%s" for="%s">%s</label> |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | // $items is either a string of <option> elements, or an array |
| 368 | 368 | // |
| 369 | -function form_select($label, $name, $items, $selected=null) { |
|
| 369 | +function form_select($label, $name, $items, $selected = null) { |
|
| 370 | 370 | echo sprintf(' |
| 371 | 371 | <div class="form-group"> |
| 372 | 372 | <label align=right class="%s" for="%s">%s</label> |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | foreach ($items as $i) { |
| 380 | 380 | echo sprintf( |
| 381 | 381 | '<option %s value=%s>%s</option>', |
| 382 | - ($i[0]==$selected)?'selected':'', |
|
| 382 | + ($i[0] == $selected) ? 'selected' : '', |
|
| 383 | 383 | $i[0], $i[1] |
| 384 | 384 | ); |
| 385 | 385 | } |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | // same, for multiple select. |
| 393 | 393 | // $selected, if non-null, is a list of selected values |
| 394 | 394 | // |
| 395 | -function form_select_multiple($label, $name, $items, $selected=null) { |
|
| 395 | +function form_select_multiple($label, $name, $items, $selected = null) { |
|
| 396 | 396 | echo sprintf(' |
| 397 | 397 | <div class="form-group"> |
| 398 | 398 | <label align=right class="%s" for="%s">%s</label> |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | foreach ($items as $i) { |
| 405 | 405 | echo sprintf( |
| 406 | 406 | '<option %s value=%s>%s</option>', |
| 407 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
| 407 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
| 408 | 408 | $i[0], $i[1] |
| 409 | 409 | ); |
| 410 | 410 | } |
@@ -413,12 +413,12 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | // return a list of string for checkbox items |
| 415 | 415 | // |
| 416 | -function checkbox_item_strings($items, $attrs='') { |
|
| 416 | +function checkbox_item_strings($items, $attrs = '') { |
|
| 417 | 417 | $x = []; |
| 418 | 418 | foreach ($items as $i) { |
| 419 | 419 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
| 420 | 420 | ', |
| 421 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
| 421 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
| 422 | 422 | ); |
| 423 | 423 | } |
| 424 | 424 | return $x; |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | // $items is list of (name, label, checked) |
| 428 | 428 | // |
| 429 | -function form_checkboxes($label, $items, $attrs='') { |
|
| 429 | +function form_checkboxes($label, $items, $attrs = '') { |
|
| 430 | 430 | echo sprintf(' |
| 431 | 431 | <div class="form-group"> |
| 432 | 432 | <label align=right class="%s">%s</label> |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
| 453 | 453 | ); |
| 454 | 454 | foreach ($items as $i) { |
| 455 | - $checked = ($selected == $i[0])?"checked":""; |
|
| 455 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
| 456 | 456 | echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br> |
| 457 | 457 | ', |
| 458 | 458 | $name, $i[0], $checked, $i[1] |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | '; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | -function form_submit($text, $attrs='') { |
|
| 488 | +function form_submit($text, $attrs = '') { |
|
| 489 | 489 | form_general( |
| 490 | 490 | "", |
| 491 | 491 | sprintf('<button %s type="submit" class="btn btn-success">%s</button>', |
@@ -494,11 +494,11 @@ discard block |
||
| 494 | 494 | ); |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | -function form_checkbox($label, $name, $checked=false) { |
|
| 497 | +function form_checkbox($label, $name, $checked = false) { |
|
| 498 | 498 | echo sprintf(' |
| 499 | 499 | <div class="form-group"> |
| 500 | 500 | <input type="checkbox" name="%s" %s> <span class="lead">%s</span> |
| 501 | 501 | </div> |
| 502 | - ', $name, $checked?"checked":"", $label |
|
| 502 | + ', $name, $checked ? "checked" : "", $label |
|
| 503 | 503 | ); |
| 504 | 504 | } |