. .

' . "\n" . 'order allow,deny' . "\n" . 'deny from all' . "\n" . '' ); fclose( $htaccess_file ); } else { add_action( 'admin_notices', 'inspry_toolkit_show_file_error' ); } } // Set up function to check for the rule function inspry_toolkit_check_for_config_rule() { $htaccess_file_path = ABSPATH . '.htaccess'; $htaccess_search_for = '# AGENCY TOOLKIT - SECURE WP CONFIG'; $htaccess_file = file_get_contents( $htaccess_file_path ); if ( strpos( $htaccess_file, $htaccess_search_for ) !== false ) { return true; } else { return false; } } // Make sure we haven't already written the rule function inspry_toolkit_run_custom_config_rule() { if ( ! inspry_toolkit_check_for_config_rule() ) { // Write the rule inspry_toolkit_write_config_rule(); } } add_action( 'init', 'inspry_toolkit_run_custom_config_rule' );