You are here

function ds_file_preg_replace in Display Suite 7.2

Same name and namespace in other branches
  1. 8.2 drush/ds.drush.inc \ds_file_preg_replace()
  2. 8.3 drush/ds.drush.inc \ds_file_preg_replace()
  3. 7 ds.drush.inc \ds_file_preg_replace()

Perform preg_replace() on the contents of an array of files.

1 string reference to 'ds_file_preg_replace'
drush_ds_build in drush/ds.drush.inc
Create a basic template and configuration file for a new Display Suite layout.

File

drush/ds.drush.inc, line 139
Display Suite drush integration.

Code

function ds_file_preg_replace($file_paths, $find, $replace) {
  foreach ($file_paths as $path) {
    $file_contents = file_get_contents($path);
    $file_contents = preg_replace($find, $replace, $file_contents);
    file_put_contents($path, $file_contents);
  }
}