/**
     * Display the basic authentication settings field.
     *
     * @since 0.2.0
     */
    public function render_field_basic_authentication()
    {
        $value = $this->get_setting('enable_basic_authentication', 'no');
        ?>
		<p class="satispress-togglable-field">
			<label>
				<input type="checkbox" name="satispress[enable_basic_authentication]" id="satispress-enable-basic-authentication" value="yes" <?php 
        checked($value, 'yes');
        ?>
>
				<?php 
        _e('Enable HTTP Basic Authentication?', 'satispress');
        ?>
			</label>
		</p>
		<?php 
        $htaccess = new SatisPress_Htaccess($this->base_path);
        if (!$htaccess->is_writable()) {
            printf('<p class="satispress-field-error">%s</p>', __(".htaccess file isn't writable."));
        }
    }
 /**
  * Update .htaccess rules when the setting is changed.
  *
  * Creates an .htaccess file in the cache directory with a 'Deny from all' rule to prevent direct access.
  *
  * @since 0.2.0
  *
  * @param array $old_value Current settings values.
  * @param array $value Saved settings.
  */
 public function maybe_setup($old_value, $value)
 {
     if (!isset($value['enable_basic_authentication'])) {
         return;
     }
     $rules = array();
     if ('yes' === $value['enable_basic_authentication']) {
         $rules[] = 'Deny from all';
     }
     $htaccess = new SatisPress_Htaccess($this->base_path);
     $htaccess->add_rules($rules);
     $htaccess->save();
 }