PHP Класс VersionPress\Utils\WpConfigEditor

It's used mainly from our internal WP-CLI command update-config.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( $wpConfigPath, $isCommonConfig )
removeVersionPressConstants ( array $configFiles ) Removes VersionPress public constants from config files.
updateConfigConstant ( $constantName, string | number | boolean $value, boolean $usePlainValue = false ) Sets value of a constant. It creates new one if it's missing.
updateConfigVariable ( $variableName, string | number | boolean $value, boolean $usePlainValue = false ) Sets value of a variable. It creates new one if it's missing.

Приватные методы

Метод Описание
findPositionForAddingNewDefinition ( $wpConfigContent )
updateConfig ( $value, $replaceRegex, $definitionTemplate, $usePlainValue )

Описание методов

__construct() публичный метод

public __construct ( $wpConfigPath, $isCommonConfig )

removeVersionPressConstants() публичный статический метод

Removes VersionPress public constants from config files.
public static removeVersionPressConstants ( array $configFiles )
$configFiles array List of config file paths from which constants should be removed.

updateConfigConstant() публичный метод

By default it saves string in single quotes. See $usePlainValue.
public updateConfigConstant ( $constantName, string | number | boolean $value, boolean $usePlainValue = false )
$constantName
$value string | number | boolean
$usePlainValue boolean The value is used as-is, without quoting.

updateConfigVariable() публичный метод

By default it saves string in single quotes. See $usePlainValue.
public updateConfigVariable ( $variableName, string | number | boolean $value, boolean $usePlainValue = false )
$variableName
$value string | number | boolean
$usePlainValue boolean The value is used as-is, without quoting.