'drupalforfirebug_get_exec_php_callback', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); return $items; } /** * Implementation of hook_nodes() * TODO - are there other hooks we want to track? */ function drupalforfirebug_node_delete($node) { drupalforfirebug_node_process($node, 'delete'); } function drupalforfirebug_node_insert($node) { drupalforfirebug_node_process($node, 'insert'); } function drupalforfirebug_node_load($nodes, $types) { foreach($nodes as $node) { // TOOD - make this work drupalforfirebug_node_process($node, 'load'); } } function drupalforfirebug_node_update($node) { drupalforfirebug_node_process($node, 'update'); } function drupalforfirebug_node_validate($node) { drupalforfirebug_node_process($node, 'validate'); } function drupalforfirebug_node_view($node) { drupalforfirebug_node_process($node, 'view'); } /** * Processing function for Node API */ function drupalforfirebug_node_process(&$node, $op) { global $dfp_runtime; if (!user_access('Access Firebug Debug')) { return; } $nid = (isset($node->nid)) ? $node->nid : '*'. t('NEW') . '*'; $data = drupalforfirebug_array_compare((array) $dfp_runtime['drupalforfirebug_nodes']['original'][$node->type][$nid], (array) $node); $output = drupalforfirebug_field_object('node', $nid, $op, $data); drupalforfirebug_log($output, 'hook_nodeapi'); } /** * Implementation of hook_views_pre_view(); */ function drupalforfirebug_views_pre_view(&$view, &$display_id) { global $dfp_runtime; if (!user_access('Access Firebug Debug')) { return; } $data = drupalforfirebug_array_compare((array) $dfp_runtime['drupalforfirebug_views']['original'][$view->name], (array) $view); $output = drupalforfirebug_field_object('view', $view->name, NULL, $data); drupalforfirebug_log($output, 'hook_views'); } /** * Implementation of hook_page_alter() */ function drupalforfirebug_page_alter(&$page) { global $dfp_runtime; // TODO - make this work without recursion problems // $data = drupalforfirebug_array_compare((array) $dfp_runtime['drupalforfirebug_page']['original']['page'], (array) $page); // $output = drupalforfirebug_field_object('page', 'page', NULL, $data); $output = t('Page Alter Support is Not Yet Implemented'); drupalforfirebug_log($output, 'hook_page_alter'); } /** * Implementation of hook_form_alter() */ function drupalforfirebug_form_alter(&$form, &$form_state, $form_id) { global $dfp_runtime; if (!user_access('Access Firebug Debug')) { return; } if ($form_id != 'drupalforfirebug_execute_form') { $form_modified = (array) $form; $data = drupalforfirebug_array_compare($dfp_runtime['drupalforfirebug_forms']['original'][$form_id], $form_modified); $output = drupalforfirebug_field_object('form', $form_id, NULL, $data); drupalforfirebug_log($output, 'hook_form_alter'); } } /** * Implementation of hook_users() */ function drupalforfirebug_user_insert(&$edit, $account, $category) { drupalforfirebug_user_processing('insert', $account); } function drupalforfirebug_user_load($users) { foreach($users as $account) { drupalforfirebug_user_processing('insert', $account); } } // TODO - more user hook stuff /** * Processor for Hook Usering */ function drupalforfirebug_user_processing($op, &$account) { global $dfp_runtime; if (!user_access('Access Firebug Debug')) { return; } if (isset($account->uid)) { $uid = $account->uid; $name = $account->name; } else { $uid = '*' . t('NEW') . '*'; $name = '*' . t('NEW') . '*'; } if (is_object($account)) { $account_clone = clone($account); $account_clone->pass = '**' . t('Not shown for security reasons') . '**'; $data = drupalforfirebug_array_compare((array) $account_clone, (array) $account_clone); $output = drupalforfirebug_field_object('user', $uid, $op, $data); drupalforfirebug_log($output, 'hook_user'); } } /** * API Function to Record a Message to the Drupal Firebug Log */ function drupalforfirebug_log($message, $type = 'general') { global $dfp_runtime; $dfp_runtime['firebug_messages'][$type][] = $message; } /** * Command Function to Record a Data Element to the Drupal Firebug Log */ function firep($element, $title = NULL) { if ($title) { drupalforfirebug_log(''.$title.':'); } drupalforfirebug_log('
'. print_r($element, true) . '', 'general'); } /** * Output Function to Return the Results of the Log */ function drupalforfirebug_get($panetype) { global $dfp_runtime; $output = ''; if (isset($dfp_runtime['firebug_messages'][$panetype])) { foreach($dfp_runtime['firebug_messages'][$panetype] as $message) { $output .= '
<?php ?>
tags.')
);
$form['token'] = array(
'#type' => 'hidden',
'#value' => drupal_get_token(),
);
$form['op'] = array('#type' => 'submit', '#value' => t('Execute'));
$form['#redirect'] = FALSE;
$form['#action'] = url('admin/firebug/exec', array('absolute' => TRUE));
$form['#skip_duplicate_check'] = TRUE;
return $form;
}
function drupalforfirebug_get_php_exec_area() {
$output = '';
return $output;
}
function drupalforfirebug_get_php_exec($code = NULL, $token = NULL) {
$output = '';
$output .= '