# defender-security/5.7.0/src/model/setting/class-security-tweaks.php

Defender Security – Malware Scanner, Login Security &amp; Firewall, version 5.7.0. 152 lines.

- Page: https://pluginprobe.com/plugins/defender-security/5.7.0/code/src/model/setting/class-security-tweaks.php
- Raw: https://pluginprobe.com/plugins/defender-security/5.7.0/raw/src/model/setting/class-security-tweaks.php
- Modified: 2025-11-24T09:39:02+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/defender-security/5.7.0/code/src/model/setting/class-security-tweaks.php#L10-L20`.

```php
<?php
/**
 * Handle tweaks settings.
 *
 * @package WP_Defender\Model\Setting
 */

namespace WP_Defender\Model\Setting;

use Calotes\Model\Setting;

/**
 * Model for tweaks settings.
 */
class Security_Tweaks extends Setting {

	/**
	 * Option name.
	 *
	 * @var string
	 */
	protected $table = 'hardener_settings';

	/**
	 * Store a list of issues tweaks, as slug.
	 *
	 * @var array
	 */
	public $issues = array();

	/**
	 * Store a list of fixed tweaks, as slug.
	 *
	 * @var array
	 */
	public $fixed = array();

	/**
	 * Store a list of ignored tweaks, as slug.
	 *
	 * @var array
	 */
	public $ignore = array();

	/**
	 * Contains all the data generated by rules.
	 *
	 * @var array
	 */
	public $data = array();

	/**
	 * Last time visit into the hardener page.
	 *
	 * @var integer
	 */
	public $last_seen;

	/**
	 * Last notification sent out.
	 *
	 * @var integer
	 */
	public $last_sent;
	/**
	 * Automate tweaks
	 *
	 * @var bool
	 */
	public $automate = false;

	/**
	 * Check if a tweak is ignored.
	 *
	 * @param string $slug  Tweak slug.
	 *
	 * @return bool
	 */
	public function is_tweak_ignore( string $slug ): bool {
		// Empty ignored tweak is string on old versions, so change it to array.
		if ( is_string( $this->ignore ) ) {
			$this->ignore = '' === $this->ignore ? array() : array( $this->ignore );
			$this->save();
		}

		return in_array( $slug, $this->ignore, true );
	}

	/**
	 * Is the tweak in the Issue list?.
	 *
	 * @param string $slug  Tweak slug.
	 *
	 * @return bool
	 */
	public function is_tweak_issue( string $slug ): bool {
		return in_array( $slug, $this->issues, true );
	}

	/**
	 * Mark a tweak as actioned.
	 *
	 * @param  string $status  Status.
	 * @param  string $slug  Tweak slug.
	 */
	public function mark( $status, $slug ) {
		foreach ( array( 'issues', 'fixed', 'ignore' ) as $collection ) {
			$arr   = $this->$collection;
			$index = array_search( $slug, $arr, true );
			if ( false !== $index ) {
				unset( $arr[ $index ] );
			}
			$this->$collection = $arr;
		}
		if ( \WP_Defender\Controller\Security_Tweaks::STATUS_RESTORE === $status ) {
			$status = \WP_Defender\Controller\Security_Tweaks::STATUS_ISSUES;
		}
		$collection      = $this->{$status};
		$collection[]    = $slug;
		$this->{$status} = $collection;
		$this->save();
	}

	/**
	 * Define settings labels.
	 *
	 * @return array
	 */
	public function labels(): array {
		return array(
			'data'     => 'data',
			'fixed'    => esc_html__( 'Actioned', 'defender-security' ),
			'issues'   => esc_html__( 'Recommendations', 'defender-security' ),
			'ignore'   => esc_html__( 'Ignored', 'defender-security' ),
			'automate' => 'automate',
		);
	}

	/**
	 * Todo: Find a less expensive way.
	 *
	 * @return array
	 */
	public function get_tweak_types(): array {
		return array(
			'count_fixed'   => count( $this->fixed ),
			'count_ignored' => count( $this->ignore ),
			'count_issues'  => count( $this->issues ),
		);
	}
}

```
