## wp config – How to specify server path in code?

Question

I am attempting to get the ACE editor to display wp-config.php for editing within the admin area (writing a plugin to do this). I assume I need to specify the server path for file_get_contents() but it’s not working. Also, specifying the server path to the editor, as currently I am using the url. Any assistance would be greatly appreciated.🙏

<!DOCTYPE html>
<html lang="en">
<title>ACE in Action</title>
<style type="text/css" media="screen">
#editor {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
</style>
<body>
<?php
$s = file_get_contents('var/www/html/wp-config.php'); ?> <div id="editor"></div> <script src="https://sketchwhatyousee.com/wp-content/plugins/wp-config-editor/ace/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script> <script> var s="<?=$s ?>";
var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
editor.session.setMode("ace/mode/php");
editor.session.setValue(s);
</script>
</body>
</html>


0
2 weeks 2023-01-25T13:36:39-05:00 0 Answers 0 views 0