You are here

function coder_upgrade_upgrade_call_drupal_eval_alter in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_upgrade/conversions/call.inc \coder_upgrade_upgrade_call_drupal_eval_alter()

Implements hook_upgrade_call_drupal_eval_alter().

File

coder_upgrade/conversions/call.inc, line 820
Provides conversion routines applied to function calls.

Code

function coder_upgrade_upgrade_call_drupal_eval_alter(&$node, &$reader) {

  // DONE
  // Create helper objects.
  $editor = PGPEditor::getInstance();

  // Get the function call object.
  $item =& $node->data;

  // Process function call.
  $name =& $item->name;

  /*
   * Examine the statement containing the function call.
   * Wrap the containing statement in an "if (module_exists('php'))" block.
   * The function call may be the containing statement.
   */

  // Set the name of the function call.
  $name['value'] = 'php_eval';

  // Get the parent = statement (i.e. node) this function call is part of.
  $parent = $item->parent;
  $temp = $editor
    ->statementsToText($parent);
  $temp = $editor
    ->textToStatements("if (module_exists('php')) {\n\t{$temp}\n}");
  $parent->data = $temp
    ->getElement(0);
}