Group id to label. */ public static function groups(): array { return array( 'general' => __( 'General', 'hostkhata' ), 'currency' => __( 'Currency', 'hostkhata' ), 'tax' => __( 'Tax', 'hostkhata' ), 'invoices' => __( 'Invoices', 'hostkhata' ), 'emails' => __( 'Emails', 'hostkhata' ), 'reminders' => __( 'Reminders', 'hostkhata' ), 'portal' => __( 'Portal', 'hostkhata' ), 'advanced' => __( 'Advanced', 'hostkhata' ), ); } /** * All setting definitions keyed by setting name. * * @since 0.1.0 * * @return array> */ public static function fields(): array { $site_name = wp_specialchars_decode( (string) get_bloginfo( 'name' ), ENT_QUOTES ); $site_email = (string) get_option( 'admin_email', '' ); return array( // General. 'business_name' => array( 'group' => 'general', 'type' => 'string', 'default' => $site_name, 'max' => 120, 'label' => __( 'Business name', 'hostkhata' ), ), 'business_email' => array( 'group' => 'general', 'type' => 'email', 'default' => $site_email, 'label' => __( 'Business email', 'hostkhata' ), 'help' => __( 'Shown on invoices and used as the default reply address.', 'hostkhata' ), ), 'business_phone' => array( 'group' => 'general', 'type' => 'string', 'default' => '', 'max' => 40, 'label' => __( 'Business phone', 'hostkhata' ), ), 'business_address' => array( 'group' => 'general', 'type' => 'textarea', 'default' => '', 'max' => 500, 'label' => __( 'Business address', 'hostkhata' ), ), 'business_website' => array( 'group' => 'general', 'type' => 'url', 'default' => '', 'label' => __( 'Website', 'hostkhata' ), 'help' => __( 'Printed on invoices.', 'hostkhata' ), ), 'business_tax_id' => array( 'group' => 'general', 'type' => 'string', 'default' => '', 'max' => 60, 'label' => __( 'Tax or business ID', 'hostkhata' ), 'help' => __( 'VAT, BIN or TIN number printed on invoices.', 'hostkhata' ), ), 'business_logo_url' => array( 'group' => 'general', 'type' => 'url', 'default' => '', 'label' => __( 'Logo URL', 'hostkhata' ), 'help' => __( 'Used on invoices, emails and the customer portal.', 'hostkhata' ), ), // Currency. 'currency_code' => array( 'group' => 'currency', 'type' => 'string', 'default' => 'BDT', 'max' => 3, 'required' => true, 'uppercase' => true, 'pattern' => '/^[A-Z]{3}$/', 'pattern_message' => __( 'Use exactly three letters, for example BDT.', 'hostkhata' ), 'label' => __( 'Currency code', 'hostkhata' ), 'help' => __( 'Three letters, for example BDT or USD.', 'hostkhata' ), ), 'currency_symbol' => array( 'group' => 'currency', 'type' => 'string', 'default' => '৳', 'max' => 8, 'label' => __( 'Currency symbol', 'hostkhata' ), ), 'currency_position' => array( 'group' => 'currency', 'type' => 'enum', 'default' => 'before', 'choices' => array( 'before' => __( 'Before the amount', 'hostkhata' ), 'after' => __( 'After the amount', 'hostkhata' ), ), 'label' => __( 'Symbol position', 'hostkhata' ), ), 'currency_decimals' => array( 'group' => 'currency', 'type' => 'int', 'default' => 2, 'min' => 0, 'max' => 4, 'label' => __( 'Decimals', 'hostkhata' ), 'help' => __( 'Amounts are stored in the smallest unit, so change this before you create invoices.', 'hostkhata' ), ), 'thousand_separator' => array( 'group' => 'currency', 'type' => 'string', 'default' => ',', 'max' => 1, 'label' => __( 'Thousands separator', 'hostkhata' ), ), 'decimal_separator' => array( 'group' => 'currency', 'type' => 'string', 'default' => '.', 'max' => 1, 'required' => true, 'label' => __( 'Decimal separator', 'hostkhata' ), ), // Tax. 'tax_enabled' => array( 'group' => 'tax', 'type' => 'bool', 'default' => false, 'label' => __( 'Charge tax', 'hostkhata' ), ), 'tax_label' => array( 'group' => 'tax', 'type' => 'string', 'default' => 'VAT', 'max' => 30, 'label' => __( 'Tax label', 'hostkhata' ), ), 'prices_include_tax' => array( 'group' => 'tax', 'type' => 'bool', 'default' => false, 'label' => __( 'Prices include tax', 'hostkhata' ), ), // Invoices and orders. 'invoice_prefix' => array( 'group' => 'invoices', 'type' => 'string', 'default' => 'INV-', 'max' => 10, 'label' => __( 'Invoice number prefix', 'hostkhata' ), ), 'order_prefix' => array( 'group' => 'invoices', 'type' => 'string', 'default' => 'ORD-', 'max' => 10, 'label' => __( 'Order number prefix', 'hostkhata' ), ), 'number_padding' => array( 'group' => 'invoices', 'type' => 'int', 'default' => 5, 'min' => 1, 'max' => 10, 'label' => __( 'Number padding', 'hostkhata' ), 'help' => __( 'Digits in invoice and order numbers, for example 5 gives INV-00042.', 'hostkhata' ), ), 'invoice_due_days' => array( 'group' => 'invoices', 'type' => 'int', 'default' => 7, 'min' => 0, 'max' => 365, 'label' => __( 'Payment terms (days)', 'hostkhata' ), ), 'grace_days' => array( 'group' => 'invoices', 'type' => 'int', 'default' => 3, 'min' => 0, 'max' => 90, 'label' => __( 'Grace period after due date (days)', 'hostkhata' ), ), 'invoice_ahead_days' => array( 'group' => 'invoices', 'type' => 'int', 'default' => 14, 'min' => 0, 'max' => 90, 'label' => __( 'Send renewal invoices this many days ahead', 'hostkhata' ), 'help' => __( 'Hosting and domain renewals are invoiced automatically this long before they are due.', 'hostkhata' ), ), 'renewal_combine' => array( 'group' => 'invoices', 'type' => 'bool', 'default' => false, 'label' => __( 'Combine renewals into one invoice per customer', 'hostkhata' ), ), 'auto_suspend_enabled' => array( 'group' => 'invoices', 'type' => 'bool', 'default' => false, 'label' => __( 'Mark overdue hosting as suspended and lapsed domains as expired', 'hostkhata' ), 'help' => __( 'After the grace period. This only changes the label in HostKhata; nothing is sent to a server or registrar.', 'hostkhata' ), ), 'late_fee_enabled' => array( 'group' => 'invoices', 'type' => 'bool', 'default' => false, 'label' => __( 'Charge a late fee', 'hostkhata' ), ), 'late_fee_type' => array( 'group' => 'invoices', 'type' => 'enum', 'default' => 'fixed', 'choices' => array( 'fixed' => __( 'Fixed amount', 'hostkhata' ), 'percent' => __( 'Percentage of invoice', 'hostkhata' ), ), 'label' => __( 'Late fee type', 'hostkhata' ), ), 'late_fee_value' => array( 'group' => 'invoices', 'type' => 'decimal', 'default' => '0', 'label' => __( 'Late fee value', 'hostkhata' ), ), 'payment_instructions' => array( 'group' => 'invoices', 'type' => 'textarea', 'default' => '', 'max' => 2000, 'label' => __( 'Payment instructions', 'hostkhata' ), 'help' => __( 'Bank account or mobile payment details printed on invoices.', 'hostkhata' ), ), 'invoice_footer' => array( 'group' => 'invoices', 'type' => 'textarea', 'default' => '', 'max' => 1000, 'label' => __( 'Invoice footer', 'hostkhata' ), ), 'invoice_watermark' => array( 'group' => 'invoices', 'type' => 'bool', 'default' => true, 'label' => __( 'Show a status watermark on invoices', 'hostkhata' ), 'help' => __( 'A large PAID, UNPAID or CANCELLED mark behind the invoice.', 'hostkhata' ), ), 'invoice_public_links' => array( 'group' => 'invoices', 'type' => 'bool', 'default' => false, 'label' => __( 'Allow viewing invoices without logging in', 'hostkhata' ), 'help' => __( 'Customers get a private link with a long random token.', 'hostkhata' ), ), // Emails. 'email_from_name' => array( 'group' => 'emails', 'type' => 'string', 'default' => $site_name, 'max' => 120, 'label' => __( 'Sender name', 'hostkhata' ), ), 'email_from_address' => array( 'group' => 'emails', 'type' => 'email', 'default' => $site_email, 'label' => __( 'Sender email address', 'hostkhata' ), ), 'email_admin_recipient' => array( 'group' => 'emails', 'type' => 'email', 'default' => $site_email, 'label' => __( 'Send admin notifications to', 'hostkhata' ), ), 'email_batch_size' => array( 'group' => 'emails', 'type' => 'int', 'default' => 20, 'min' => 1, 'max' => 200, 'label' => __( 'Emails sent per queue run', 'hostkhata' ), 'help' => __( 'Keeps each run short on shared hosting.', 'hostkhata' ), ), // Reminders. 'reminders_enabled' => array( 'group' => 'reminders', 'type' => 'bool', 'default' => true, 'label' => __( 'Send reminders', 'hostkhata' ), ), 'reminder_send_hour' => array( 'group' => 'reminders', 'type' => 'int', 'default' => 9, 'min' => 0, 'max' => 23, 'label' => __( 'Send reminders after this hour (site time)', 'hostkhata' ), 'help' => __( 'Quiet hours: no reminders go out before this hour.', 'hostkhata' ), ), 'reminder_admin_copy' => array( 'group' => 'reminders', 'type' => 'bool', 'default' => false, 'label' => __( 'Send a copy of every reminder to the admin', 'hostkhata' ), ), // Portal. 'portal_page_id' => array( 'group' => 'portal', 'type' => 'page', 'default' => 0, 'label' => __( 'Customer portal page', 'hostkhata' ), 'help' => __( 'The page that contains the portal shortcode.', 'hostkhata' ), ), 'order_page_id' => array( 'group' => 'portal', 'type' => 'page', 'default' => 0, 'label' => __( 'Order page', 'hostkhata' ), ), 'register_page_id' => array( 'group' => 'portal', 'type' => 'page', 'default' => 0, 'label' => __( 'Registration page', 'hostkhata' ), ), 'portal_primary_color' => array( 'group' => 'portal', 'type' => 'color', 'default' => '#4f46e5', 'label' => __( 'Brand colour', 'hostkhata' ), ), 'registration_enabled' => array( 'group' => 'portal', 'type' => 'bool', 'default' => true, 'label' => __( 'Allow customers to register themselves', 'hostkhata' ), 'help' => __( 'Controls the [hostkhata_register] form.', 'hostkhata' ), ), 'registration_needs_approval' => array( 'group' => 'portal', 'type' => 'bool', 'default' => false, 'label' => __( 'New customers need admin approval', 'hostkhata' ), ), // Advanced. 'debug_log' => array( 'group' => 'advanced', 'type' => 'bool', 'default' => false, 'label' => __( 'Write debug information to the PHP error log', 'hostkhata' ), ), 'delete_data_on_uninstall' => array( 'group' => 'advanced', 'type' => 'bool', 'default' => false, 'label' => __( 'Delete all HostKhata data when the plugin is deleted', 'hostkhata' ), 'help' => __( 'Removes tables, roles and settings. This cannot be undone.', 'hostkhata' ), ), // System (not shown in the settings screen). 'setup_completed' => array( 'group' => 'system', 'type' => 'bool', 'default' => false, 'label' => __( 'Setup wizard completed', 'hostkhata' ), ), ); } }