PHP 클래스 WPDKConfiguration

## Overview You rarely (never) instantiate WPDKConfiguration object directly. Instead, you instantiate subclasses of the WPDKConfiguration class. ### Getting started Write a your own custom class and extends WPDKConfiguration. For example: class MySettings extends WPDKConfiguration { } Implements your custom properties and your branch to other configuration class MySettings extends WPDKConfiguration { const CONFIGURATION_NAME = 'mysetting-config'; public $version = '1.0'; function __construct() { parent::__construct( self::CONFIGURATION_NAME ); } } You can implement this utility static method to get the configuration from database or create it onfly if missing or the first time. class MySettings extends WPDKConfiguration { const CONFIGURATION_NAME = 'mysetting-config'; public $version = '1.0'; static function init() { return parent::init( self::CONFIGURATION_NAME, __CLASS__ ); } function __construct() { parent::__construct( self::CONFIGURATION_NAME ); } } If you have a sub configuration branch, or subset of configuration, use: class MySettings extends WPDKConfiguration { const CONFIGURATION_NAME = 'mysetting-config'; public $version = '1.0'; My configuration branch public $branch; static function init() { return parent::init( self::CONFIGURATION_NAME, __CLASS__ ); } function __construct() { parent::__construct( self::CONFIGURATION_NAME ); $this->branch = new MyConfigurationBranch(); } } class MyConfigurationBranch { public $number_of_seat; function __construct() { $this->number_of_seat = 10; // Default value } } ### Reset to default values The code above shows how it possible reset all or a portion of your configuration. To reset a branch to default values just: $myconfiguration->branch = new MyConfigurationBranch(); If you like it possible implement a simple resetToDefault() method as: class MyConfigurationBranch { public $number_of_seat; function __construct() { $this->resetToDefault(); } function resetToDefault() { $this->number_of_seat = 10; // Default value } } ### Developing When you are in develop your settings change and the store object on db could be different from last develop version. No problem, you can invoke the delta() method to perform a delta from the database version and the onfly (last) version. This method usually is called on activation of plugin. In this way you can align the configuration setting just deactive and re active your plugin.
사용 중단: since 1.2.0 use WPDKPreferences instead
부터: 0.6.2
저자: =undo= ([email protected])
파일 보기 프로젝트 열기: wpxtreme/wpdk 1 사용 예제들

공개 메소드들

메소드 설명
delete ( ) Delete this configuration
delta ( ) : object Do a delta compare/combine from two tree object config
init ( ) public static function init( $name = null, $class_name = null ) {
update ( ) Update on database this configuration.

보호된 메소드들

메소드 설명
__construct ( string $name ) Return an instance of WPDKConfiguration class

메소드 상세

__construct() 보호된 메소드

Return an instance of WPDKConfiguration class
protected __construct ( string $name )
$name string A string used as name for options. Make it unique more possible.

delete() 공개 메소드

Delete this configuration
public delete ( )

delta() 공개 메소드

Do a delta compare/combine from two tree object config
public delta ( ) : object
리턴 object

init() 공개 정적인 메소드

public static function init( $name = null, $class_name = null ) {
public static init ( )

update() 공개 메소드

Update on database this configuration.
public update ( )