You are here

function ds_file_preg_replace in Display Suite 8.2

Same name and namespace in other branches
  1. 8.3 drush/ds.drush.inc \ds_file_preg_replace()
  2. 7.2 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.

2 string references to 'ds_file_preg_replace'
drush_ds_build in drush/ds.drush.inc
Create a basic template and configuration file for a Display Suite layout.
drush_ds_field in drush/ds.drush.inc
Create a Display Suite plugin.

File

drush/ds.drush.inc, line 157
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);
  }
}