devel_display_source

Versions
mediamosa-21
devel_display_source($standalone = TRUE)

Page callback to display syntax hilighted source code

note: the path for this function is received via $_GET['path'] example http://www.example.com/devel/source?file=modules/node/node.module

Parameters

$standalone Set to FALSE to place the code inside a Drupal page. Otherwise code displays on its own.

Code

sites/all/modules/devel/devel.module, line 312

<?php
function devel_display_source($standalone = TRUE) {
  $path = $_GET['file'];
  // take out the nasties
  $path = str_replace('../', '', $path);
  $output = devel_highlight_file($path, $standalone);
  if ($output) {
    if ($standalone) {
      print $output;
      exit();
    }
    return $output;
  }
  else {
    drupal_set_message(t('Invalid file path'), 'error');
    drupal_not_found();
  }
}
?>