\R' . '(?:(?:|<\/IfModule>|Require all denied|order allow,deny|deny from all)\h*\R)+' . '<\/files>/i' ); } /** * Remove the Stop User Enumeration rule from .htaccess, whatever site URL it * was written with (an exact-text match stopped matching after an http to * https change, and the rule then stayed with the setting off). * * @return bool Whether the file was changed. */ function inspry_toolkit_htaccess_remove_user_enum_rule() { return inspry_toolkit_htaccess_remove( '/\R?\R?# AGENCY TOOLKIT - STOP USER ENUM\R\R' . 'RewriteCond %\{REQUEST_URI\}\h+\^\/\$\h*\R' . 'RewriteCond %\{QUERY_STRING\}\h+\^\/\?author=\(\[0-9\]\*\)\h*\R' . 'RewriteRule \^\(\.\*\)\$ [^\r\n]*\R' . '<\/IfModule>/i' ); } /** * Remove every toolkit rule from .htaccess. Runs on deactivation and * uninstall: the rules are the plugin's behaviour, so they go when it does. * Settings are kept, so reactivating writes them back on the next request. * It also means deactivating the plugin clears a rule that a server rejects. */ function inspry_toolkit_htaccess_remove_rules() { inspry_toolkit_htaccess_remove_config_rule(); inspry_toolkit_htaccess_remove_user_enum_rule(); }