public static function cleanse_file(&$file, $name = false) { switch ($name) { case 'mounts': foreach (array('ecryptfs_cipher=', 'ecryptfs_sig=', 'ecryptfs_fnek_sig=') as $check) { if (($x = stripos($file, $check)) !== false) { $split_a = substr($file, 0, $x + strlen($check)); $y = strlen($file); foreach (array(',', ' ', '&', PHP_EOL) as $next) { if (($z = stripos($file, $next, $x + strlen($check))) !== false && $z < $y) { $y = $z; } } $file = $split_a . 'XXXX' . substr($file, $y); } } break; default: $file = pts_strings::remove_lines_containing($file, array('Serial N', 'S/N', 'Serial #', 'serial:', 'serial=')); break; } }