function fpm

6.x misc.inc fpm($var, $max_levels = 20)
4.x misc.inc fpm($var)
5.x misc.inc fpm($var, $max_levels = 20)

Uses fp_add_message, but in this case, it also adds in the filename and line number which the message came from!

Most useful for developers, tracking down issues. It's also only visible to administrators with the "view_fpm_debug" permission. So if you need to display a message only to admins, you can use fpm() as a shortcut.

Note: If you attempt to fpm() an array or object with too many levels of nesting, it may run out of memory and your script will die.

19 calls to fpm()
admin_display_main in modules/admin/admin.module
This is the "main" page for the admin module. It's what the user first sees when the click to go to the Admin page.
advise_display_popup_group_select in modules/advise/advise.module
course_search_download_syllabus in modules/course_search/course_search.module
This function will actually deliver a syllabus to the user's browser for download.
depricated_message in includes/misc.inc
Displays a depricated message on screen. Useful for tracking down when depricated functions are being used.
fpmct in includes/misc.inc
Convenience function, will use fp_debug_ct() to display a message, and the number of miliseconds since its last call.

... See full list

File

includes/misc.inc, line 1645
This file contains misc functions for FlightPath

Code

function fpm($var, $max_levels = 20) {

  if (!user_has_permission("view_fpm_debug")) {
    return;
  }

  // Complex variable?  Change it to print_r.
  $str = $var;
  if (is_array($str) || is_object($str)) {
    $str = "<div class='fp-html-print-r-wrapper'>" . fp_html_print_r($str, "", 0, $max_levels) . "</div>";
  }

  $arr = debug_backtrace();
  //pretty_print($arr);

  $t = 0;

  if (@$arr [1]['function'] == 'fpmct') {
    $t = 1;
  }

  $file = $arr [$t]["file"];
  if (strlen($file) > 70) {
    $file = "..." . substr($file, strlen($file) - 70);
  }
  $str .= "<div class='fp-message-backtrace'>line {$arr [$t]["line"]}: $file</div>";

  fp_add_message("&bull; " . $str);


}