File "validator.php"

Full path: /home/satitravel/public_html/plugins/better-wp-security/core/modules/404-detection/validator.php
File size: 1.04 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

<?php

class ITSEC_Four_Oh_Four_Validator extends ITSEC_Validator {
	public function get_id() {
		return '404-detection';
	}
	
	protected function sanitize_settings() {
		$this->sanitize_setting( 'positive-int', 'check_period', __( 'Minutes to Remember 404 Error (Check Period)', 'better-wp-security' ) );
		$this->sanitize_setting( 'positive-int', 'error_threshold', __( 'Error Threshold', 'better-wp-security' ) );
		
		$this->sanitize_setting( array( $this, 'sanitize_white_list_entry' ), 'white_list', __( '404 File/Folder White List', 'better-wp-security' ) );
		$this->sanitize_setting( array( $this, 'sanitize_types_entry' ), 'types', __( '404 File/Folder White List', 'better-wp-security' ) );
	}
	
	protected function sanitize_white_list_entry( $entry ) {
		if ( '/' !== substr( $entry, 0, 1 ) ) {
			return false;
		}
		
		return $entry;
	}
	
	protected function sanitize_types_entry( $entry ) {
		if ( '.' !== substr( $entry, 0, 1 ) ) {
			return false;
		}
		
		return $entry;
	}
}

ITSEC_Modules::register_validator( new ITSEC_Four_Oh_Four_Validator() );