'admin/firebug/exec', 'callback' => 'drupalforfirebug_get_exec_php_callback', ); } return $items; } /** * Implementation of hook_nodeapi() */ function drupalforfirebug_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { $nid = ($node->nid) ? $node->nid : '*NEW*'; $output = '
'; $output .= '' . $op . ' $node->'.$nid . ''; $output .= '
' . ' $node = stdClass Object (' . '
'; $output .= drupalforfirebug_array_compare(objectToArray($_SESSION['drupalforfirebug_nodes']['original'][$node->type][$nid]), objectToArray($node)); $output .= '
' . ' );
'; drupalforfirebug_log($output, 'hook_nodeapi'); } /** * Implementation of hook_form_alter() */ function drupalforfirebug_form_alter($formid, &$form) { $output = '
'; $output .= ''. $formid . ''; $output .= '
' . ' $form = array (' . '
'; $output .= drupalforfirebug_array_compare($_SESSION['drupalforfirebug_forms']['original'][$formid], $form); $output .= '
' . ' );
'; drupalforfirebug_log($output, 'hook_form_alter'); } /** * Implementation of hook_user() */ function drupalforfirebug_user($op, &$edit, &$account, $category = NULL) { $uid = ($account->uid) ? $account->uid : '*NEW*'; $output = '
'; $output .= ''. $op .' $account->'. $account->name . ''; $output .= '
' . ' $account = stdClass (' . '
'; $output .= drupalforfirebug_array_compare(objectToArray($account), objectToArray($account)); // $output .= drupalforfirebug_array_compare(objectToArray($_SESSION['drupalforfirebug_user']['original'][$uid], $account); $output .= '
' . ' );
'; drupalforfirebug_log($output, 'hook_user'); } /** * API Function to Record a Message to the Drupal Firebug Log */ function drupalforfirebug_log($message, $type = 'general') { $_SESSION['firebug_messages'][$type][] = $message; } /** * Command Function to Record a Data Element to the Drupal Firebug Log */ function firep($element) { drupalforfirebug_log('
'. print_r($element, true) . '
', 'Debugging Messages'); } /** * Output Function to Return the Results of the Log */ function drupalforfirebug_get($panetype) { if (isset($_SESSION['firebug_messages'][$panetype])) { foreach($_SESSION['firebug_messages'][$panetype] as $message) { $output .= '
'. $message .'
'; } unset($_SESSION['firebug_messages'][$panetype]); return $output; } } /** * Output Function to Return the Results of the SQL Log */ function drupalforfirebug_get_sql_log() { if (!module_exists('devel')) { $output = '

Devel Module is Not Installed

'; $output .= 'Please install and enable the Devel Module to display the SQL queries.'; return $output; } if (!variable_get('dev_query', 0)) { $output = '

Query Logging is Not Enabled

'; $output .= 'Please enable query logging in the Devel Module Settings to use this feature.'; return $output; } if (module_exists('devel') && variable_get('dev_query', 0)) { global $queries; list($counts, $query_summary) = devel_query_summary(); $output = '

SQL Query Log

'; $output .= devel_query_table($queries, $counts); } else { if (!variable_get('dev_query', 0) && module_exists('devel')) { global $base_url; $output = t('Please Enable the Devel Modules to Log SQL Queries: ') . ' ' . l(t('Enable SQL Queries'), $base_url.'/admin/settings/devel', array('target' => '_blank')) . '.'; } else { $output = t('Please enable the Devel Module to see the SQL Queries.') . ' ' . l(t('See Devel Project Page'),'http://www.drupal.org/project/devel', array('target' => '_blank')) .'.'; } } return $output; } /** * Generates an Execute PHP Drupal For Firebug Form **/ function drupalforfirebug_execute_form() { $form['code'] = array( '#type' => 'textarea', '#description' => t('Enter PHP code for execution. Do not use <?php ?> tags.') ); $form['op'] = array('#type' => 'submit', '#value' => t('Execute')); $form['#redirect'] = FALSE; global $base_url; $form['#action'] = $base_url . '/admin/firebug/exec'; $form['#skip_duplicate_check'] = TRUE; return $form; } function drupalforfirebug_get_php_exec_area() { global $base_url; $output .= '