PHP Class WC_Admin_Settings

显示文件 Open project: woocommerce/woocommerce Class Usage Examples

Public Methods

Method Description
add_error ( string $text ) Add an error.
add_message ( string $text ) Add a message.
check_download_folder_protection ( ) Checks which method we're using to serve downloads.
get_field_description ( array $value ) : array Helper function to get the formated description and tip HTML for a given form field. Plugins can call this when implementing their own custom settings types.
get_option ( mixed $option_name, $default = '' ) : string Get a setting from the settings API.
get_settings_pages ( ) Include the settings page classes.
output ( ) Settings page.
output_fields ( array $options ) Output admin fields.
save ( ) Save the settings.
save_fields ( array $options, array $data = null ) : boolean Save admin fields.
show_messages ( ) : string Output messages + errors.

Method Details

add_error() public static method

Add an error.
public static add_error ( string $text )
$text string

add_message() public static method

Add a message.
public static add_message ( string $text )
$text string

check_download_folder_protection() public static method

If using force or x-sendfile, this ensures the .htaccess is in place.

get_field_description() public static method

Helper function to get the formated description and tip HTML for a given form field. Plugins can call this when implementing their own custom settings types.
public static get_field_description ( array $value ) : array
$value array The form field value array
return array The description and tip as a 2 element array

get_option() public static method

Get a setting from the settings API.
public static get_option ( mixed $option_name, $default = '' ) : string
$option_name mixed
return string

get_settings_pages() public static method

Include the settings page classes.
public static get_settings_pages ( )

output() public static method

Handles the display of the main woocommerce settings page in admin.
public static output ( )

output_fields() public static method

Loops though the woocommerce options array and outputs each field.
public static output_fields ( array $options )
$options array Opens array to output

save() public static method

Save the settings.
public static save ( )

save_fields() public static method

Loops though the woocommerce options array and outputs each field.
public static save_fields ( array $options, array $data = null ) : boolean
$options array Options array to output
$data array Optional. Data to use for saving. Defaults to $_POST.
return boolean

show_messages() public static method

Output messages + errors.
public static show_messages ( ) : string
return string