czlexpress-for-woocommerce/includes/class-czl-settings.php
wood chen 7b7f41d0cc Refactor and Update CZL Express for WooCommerce Plugin
- Renamed the plugin from "woocommerce-czlexpress" to "CZL Express for WooCommerce" for better branding.
- Updated README and readme.txt files to reflect the new plugin name and improved description.
- Enhanced system requirements to support PHP 8.0 and tested compatibility with WordPress 6.7.
- Removed outdated files and references, including the main plugin file and language files.
- Improved localization by updating text domain references throughout the codebase.
- Streamlined the admin interface for better usability, including updated labels and descriptions.

These changes enhance the clarity, performance, and user experience of the CZL Express plugin.
2024-12-20 13:06:48 +08:00

55 lines
1.8 KiB
PHP

<?php
class CZL_Settings {
private static $instance = null;
public static function instance() {
if (is_null(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
public function __construct() {
add_action('admin_init', array($this, 'register_settings'));
}
public function register_settings() {
register_setting('czl_options_group', 'czl_api_url');
register_setting('czl_options_group', 'czl_username');
register_setting('czl_options_group', 'czl_password');
register_setting('czl_options_group', 'czl_exchange_rate');
register_setting('czl_options_group', 'czl_product_groups');
}
public function get_settings_fields() {
return array(
'basic' => array(
array(
'name' => 'czl_api_url',
'label' => __('API URL', 'czlexpress-for-woocommerce'),
'type' => 'text',
'default' => '',
),
array(
'name' => 'czl_username',
'label' => __('Username', 'czlexpress-for-woocommerce'),
'type' => 'text',
'default' => '',
),
array(
'name' => 'czl_password',
'label' => __('Password', 'czlexpress-for-woocommerce'),
'type' => 'password',
'default' => '',
),
array(
'name' => 'czl_exchange_rate',
'label' => __('Exchange Rate', 'czlexpress-for-woocommerce'),
'type' => 'number',
'default' => '1',
'step' => '0.0001',
),
)
);
}
}