You are here

function coder_upgrade_apply_regex in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/includes/main.inc \coder_upgrade_apply_regex()

Applies regular expression conversion routines to a file.

Parameters

string $filename: The name of the file to convert.

string $new: The contents of the file to convert.

1 call to coder_upgrade_apply_regex()
coder_upgrade_convert_file in coder_upgrade/includes/main.inc
Converts a file.

File

coder_upgrade/includes/main.inc, line 305
Manages application of conversion routines, logging, and patch file creation.

Code

function coder_upgrade_apply_regex($filename, &$new) {

  // Categorize certain files.
  $is_info_file = pathinfo($filename, PATHINFO_EXTENSION) == 'info';
  $is_install_file = pathinfo($filename, PATHINFO_EXTENSION) == 'install';
  if ($is_info_file) {

    // Apply regular expression conversion routines for info file.
    coder_upgrade_log_print("Calling hook_upgrade_regex_info_alter");
    drupal_alter('upgrade_regex_info', $new);
    coder_upgrade_log_print("Completed hook_upgrade_regex_info_alter");
    return;
  }
  if ($is_install_file) {

    // Apply regular expression conversion routines for install file.
    coder_upgrade_log_print("Calling hook_upgrade_regex_install_alter");
    drupal_alter('upgrade_regex_install', $new);
    coder_upgrade_log_print("Completed hook_upgrade_regex_install_alter");
  }

  // Apply regular expression conversion routines.
  coder_upgrade_log_print("Calling hook_upgrade_regex_alter");
  drupal_alter('upgrade_regex', $new);
  coder_upgrade_log_print("Completed hook_upgrade_regex_alter");
}