options['system']['admin_log_retention_period'] ) ) { $options['system']['operation_log']['admin_log_retention_period'] = $usces->options['system']['admin_log_retention_period']; } else { $options['system']['operation_log']['admin_log_retention_period'] = '6 months'; } } update_option( 'usces_ex', $options ); self::$opts = $options['system']['operation_log']; } /** * Check if the operation log is enabled or not. * * @return boolean true/false */ public static function is_enabled() { return 1 === self::$opts['status']; } /** * Check if the operation log is enabled or not. * * @return boolean true/false */ public static function is_disabled() { return 0 === self::$opts['status']; } /** * Get the retention period. * * @return string */ public static function get_retention_period() { return self::$opts['admin_log_retention_period']; } /** * Check if the order metabox is enabled or not. * * @return boolean true/false */ public static function is_order_metabox_enabled() { return self::is_enabled() && 1 === self::$opts['order_status']; } /** * Check if the member metabox is enabled or not. * * @return boolean true/false */ public static function is_member_metabox_enabled() { return self::is_enabled() && 1 === self::$opts['member_status']; } /** * Handle save data. */ public function save_data() { global $usces; $action = filter_input( INPUT_POST, 'usces_operation_log_option_update' ); if ( ! empty( $action ) ) { check_admin_referer( 'admin_system', 'wc_nonce' ); if ( ! current_user_can( 'wel_manage_setting' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } $status = filter_input( INPUT_POST, 'operation_log_status' ); $order_status = filter_input( INPUT_POST, 'order_operation_log_status' ); $member_status = filter_input( INPUT_POST, 'member_operation_log_status' ); $admin_log_retention_period = filter_input( INPUT_POST, 'admin_log_retention_period' ); self::$opts['status'] = (int) $status; if ( self::is_disabled() ) { $order_status = 0; $member_status = 0; $admin_log_retention_period = '6 months'; } self::$opts['order_status'] = (int) $order_status; self::$opts['member_status'] = (int) $member_status; self::$opts['admin_log_retention_period'] = $admin_log_retention_period; $options = get_option( 'usces_ex', array() ); $options['system']['operation_log'] = self::$opts; update_option( 'usces_ex', $options ); // Remove the log setting at the "usces" option. if ( isset( $usces->options['system']['admin_log_retention_period'] ) ) { unset( $usces->options['system']['admin_log_retention_period'] ); update_option( 'usces', $usces->options ); } } } /** * Handel build setting from. */ public function setting_form() { $status = self::$opts['status']; $order_status = self::$opts['order_status']; $member_status = self::$opts['member_status']; $admin_log_retention_period = self::$opts['admin_log_retention_period']; ?>