ANCHOR_EOF
ANCHOR_EOF = 'EOF'
Append to end of file
Transforms a wp-config.php file.
$wp_config_path : string
Path to the wp-config.php file.
$wp_config_src : string
Original source of the wp-config.php file.
__construct(string $wp_config_path, mixed $read_only = false) : mixed
Instantiates the class with a valid wp-config.php.
| string | $wp_config_path | Path to a wp-config.php file. |
| mixed | $read_only |
If the wp-config.php file is missing.
If the wp-config.php file is not writable.
exists(string $type, string $name) : bool
Checks if a config exists in the wp-config.php file.
| string | $type | Config type (constant or variable). |
| string | $name | Config name. |
If the wp-config.php file is empty.
If the requested config type is invalid.
get_value(string $type, string $name) : string|null
Get the value of a config in the wp-config.php file.
| string | $type | Config type (constant or variable). |
| string | $name | Config name. |
If the wp-config.php file is empty.
If the requested config type is invalid.
add(string $type, string $name, string $value, array<string,mixed> $options = array()) : bool
Adds a config to the wp-config.php file.
| string | $type | Config type (constant or variable). |
| string | $name | Config name. |
| string | $value | Config value. |
| array |
$options | (optional) Array of special behavior options. |
If the config value provided is not a string.
If the config placement anchor could not be located.
update(string $type, string $name, string $value, array<string,mixed> $options = array()) : bool
Updates an existing config in the wp-config.php file.
| string | $type | Config type (constant or variable). |
| string | $name | Config name. |
| string | $value | Config value. |
| array |
$options | (optional) Array of special behavior options. |
If the config value provided is not a string.
format_value(string $value, bool $raw) : bool|float|int|string|null
Applies formatting to a config value.
| string | $value | Config value. |
| bool | $raw | Display value in raw format without quotes. |
When a raw value is requested for an empty string.
normalize(string $type, string $name, bool|float|int|string|null $value) : string
Normalizes the source output for a name/value pair.
| string | $type | Config type (constant or variable). |
| string | $name | Config name. |
| bool|float|int|string|null | $value | Config value. |
If the requested config type does not support normalization.