am int $duration The duration. */ public function update_tweak_duration( int $duration ) { if ( empty( $duration ) || $this->is_incorect_duration( $duration ) ) { return; } update_site_option( self::OPTION_NAME, $duration ); } /** * Retrieve the tweak's label. * * @return string */ public function get_label(): string { return esc_html__( 'Manage Login Duration', 'wpdef' ); } /** * Get the error reason. * * @return string */ public function get_error_reason(): string { return sprintf( /* translators: %d: Number of days. */ esc_html__( 'Your current login duration is the default %d days.', 'wpdef' ), self::DEFAULT_DAYS ); } /** * Return a summary data of this tweak. * * @return array */ public function to_array(): array { $duration = $this->get_tweak_duration(); return array( 'slug' => $this->slug, 'title' => $this->get_label(), 'errorReason' => $this->get_error_reason(), 'successReason' => sprintf( /* translators: %d: Number of days. */ esc_html__( 'You\'ve adjusted the default login duration to %d days.', 'wpdef' ), $duration ), 'misc' => array( 'duration' => $duration ), 'bulk_description' => esc_html__( 'Users who select the \'remember me\' option will stay logged in for 14 days.It’s good practice to reduce this default time to reduce the risk of someone gaining access to your automatically logged in account. We’ll set the login duration to 7 days.', 'wpdef' ), 'bulk_title' => esc_html__( 'Login Duration', 'wpdef' ), ); } }