Пример #1
0
/**
 * Check if the standard rules for a normal WordPress installation (not network
 * based) are inside the main htaccess file. This only applies to websites that
 * have permalinks enabled, or 3rd-party plugins that require custom rules
 * (generally based on mod_deflate) to compress and/or generate static files for
 * cache.
 *
 * @param  string  $rules Content of the main htaccess file.
 * @return boolean        True if the htaccess has the standard rules, false otherwise.
 */
function sucuriscan_htaccess_is_standard($rules = false)
{
    if ($rules === false) {
        $rules = '';
        $htaccess_path = SucuriScan::get_htaccess_path();
        if ($htaccess_path) {
            $rules = @file_get_contents($htaccess_path);
        }
    }
    if (is_string($rules) && !empty($rules)) {
        $rewrite = new WP_Rewrite();
        $standard = $rewrite->mod_rewrite_rules();
        return (bool) (strpos($rules, $standard) !== false);
    }
    return false;
}