'' . esc_html__( 'Settings', 'ordersieve' ) . '',
'logs' => '' . esc_html__( 'Logs', 'ordersieve' ) . '',
);
return array_merge( $ours, $links );
}
/**
* Add the OrderSieve tab to the WooCommerce settings tabs.
*
* @param array $tabs Existing tabs.
*
* @return array
*/
public static function add_tab( $tabs ) {
$tabs['ordersieve'] = __( 'OrderSieve', 'ordersieve' );
return $tabs;
}
/**
* Setting definitions.
*
* @return array
*/
public static function get_settings() {
return array(
array(
'title' => __( 'Order protection', 'ordersieve' ),
'type' => 'title',
'id' => 'ordersieve_section',
),
array(
'title' => __( 'Enable protection', 'ordersieve' ),
'desc' => __( 'Block automated and fake orders at checkout', 'ordersieve' ),
'id' => self::OPTION_KEY . '[enabled]',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Minimum form fill time (seconds)', 'ordersieve' ),
'desc_tip' => __( 'Checkouts submitted faster than this are treated as bots. Use 0 to disable.', 'ordersieve' ),
'id' => self::OPTION_KEY . '[min_seconds]',
'default' => 3,
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'max' => 60,
'step' => 1,
),
),
array(
'title' => __( 'Block disposable email domains', 'ordersieve' ),
'desc' => __( 'Reject known throwaway email providers such as mailinator.com or temp-mail.org', 'ordersieve' ),
'id' => self::OPTION_KEY . '[block_disposable]',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Additional blocked email domains', 'ordersieve' ),
'desc_tip' => __( 'Extra domains to reject, one per line. Subdomains are blocked too. Developers can also use the ordersieve_disposable_domains filter.', 'ordersieve' ),
'placeholder' => "example.com\nspam-domain.net",
'id' => self::OPTION_KEY . '[custom_domains]',
'default' => '',
'type' => 'textarea',
'css' => 'min-height:90px;',
),
array(
'title' => __( 'Rejection message', 'ordersieve' ),
'desc_tip' => __( 'Shown to the customer when an order is blocked. Leave empty to use the default message, translated into the shopper\'s language.', 'ordersieve' ),
'id' => self::OPTION_KEY . '[block_message]',
// Empty default + placeholder, so saving the form does not store the
// admin's translation of the default message for every shopper.
'default' => '',
'placeholder' => __( 'Your order could not be placed. Please contact us if you believe this is a mistake.', 'ordersieve' ),
'type' => 'textarea',
),
array(
'title' => __( 'Log blocked attempts', 'ordersieve' ),
'desc' => __( 'Write blocked attempts to WooCommerce > Status > Logs (source: ordersieve)', 'ordersieve' ),
'id' => self::OPTION_KEY . '[logging]',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'type' => 'sectionend',
'id' => 'ordersieve_section',
),
array(
'title' => __( 'Junk order cleanup', 'ordersieve' ),
'type' => 'title',
'desc' => __( 'Automatically delete orders blocked by OrderSieve once per day, using WooCommerce\'s Action Scheduler (see WooCommerce > Status > Scheduled Actions). Orders you cancelled yourself are never touched.', 'ordersieve' ),
'id' => 'ordersieve_cleanup_section',
),
array(
'title' => __( 'Delete blocked orders older than (days)', 'ordersieve' ),
'desc_tip' => __( 'Removes orders blocked by OrderSieve daily, max 50 per run. Use 0 to disable.', 'ordersieve' ),
'id' => self::OPTION_KEY . '[cleanup_days]',
'default' => 0,
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'max' => 365,
'step' => 1,
),
),
array(
'type' => 'sectionend',
'id' => 'ordersieve_cleanup_section',
),
);
}
/**
* Render the settings screen.
*
* @return void
*/
public static function render() {
woocommerce_admin_fields( self::get_settings() );
}
/**
* Save the settings screen.
*
* @return void
*/
public static function save() {
woocommerce_update_options( self::get_settings() );
// Settings may have just enabled cleanup; make sure the daily event exists.
ordersieve_maybe_schedule_cleanup();
}
}