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