function hook_upgrade_regex_alter in Coder 7
Same name and namespace in other branches
- 7.2 coder_upgrade/coder_upgrade.api.php \hook_upgrade_regex_alter()
Alters the text of a code file using regular expressions.
Parameters
string $file: The text of the file to convert.
2 functions implement hook_upgrade_regex_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- coder_upgrade_upgrade_regex_alter in coder_upgrade/
conversions/ regex.inc - Implements hook_upgrade_regex_alter().
- your_module_name_upgrade_regex_alter in coder_upgrade/
coder_upgrade.api.php - Implements hook_upgrade_regex_alter().
1 invocation of hook_upgrade_regex_alter()
- coder_upgrade_apply_regex in coder_upgrade/
includes/ main.inc - Applies regular expression conversion routines to a file.
File
- coder_upgrade/
coder_upgrade.api.php, line 365 - Documents hooks provided by this module.
Code
function hook_upgrade_regex_alter(&$file) {
$hook = 'your_changes';
// Used as the label in the log file.
$cur = $file;
$new = $cur;
$from = array();
$to = array();
// Do something to $file.
$from[] = '/(your_module_name)/';
$to[] = "\$1";
coder_upgrade_do_conversions($from, $to, $new);
coder_upgrade_save_changes($cur, $new, $file, $hook);
}