File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 245
245
}
246
246
}
247
247
248
+ // File patches
249
+ patchFile ($ path . "wp-settings.php " , function ($ src ){
250
+ return str_replace ('<?php ' , '<?php if(!defined("ABSPATH")) exit(); ' , $ src ); // prevent display errors
251
+ });
252
+
248
253
// Create index.php for empty directories.
249
254
file_put_contents ($ path . "wp-content/index.php " , $ indexSource ,FILE_BINARY );
250
255
// Create .htaccess file for routing.
@@ -441,4 +446,14 @@ function sendBuffer($chunk)
441
446
}
442
447
@flush ();
443
448
@ob_flush ();
444
- }
449
+ }
450
+
451
+ function patchFile ($ file , callable $ callback = null )
452
+ {
453
+ if (file_exists ($ file ) and is_callable ($ callback ))
454
+ {
455
+ $ src = file_get_contents ($ file );
456
+ if ($ src !== false ) return file_put_contents ($ file , $ callback ($ src ), FILE_BINARY );
457
+ }
458
+ return false ;
459
+ }
You can’t perform that action at this time.
0 commit comments