Fix #250 - update htaccess functions to latest from @alkymst

This commit is contained in:
Ben Word
2012-02-13 08:25:25 -07:00
parent 49300042c8
commit 551fc9ca50

View File

@@ -53,7 +53,6 @@ if (stristr($_SERVER['SERVER_SOFTWARE'], 'apache') !== false) {
if (!is_multisite() && !is_child_theme()) {
add_action('generate_rewrite_rules', 'roots_add_rewrites');
add_action('generate_rewrite_rules', 'roots_add_h5bp_htaccess');
add_action('activate_plugin', 'roots_add_h5bp_htaccess');
if (!is_admin()) {
add_filter('plugins_url', 'roots_clean_plugins');
add_filter('bloginfo', 'roots_clean_assets');
@@ -67,16 +66,12 @@ if (stristr($_SERVER['SERVER_SOFTWARE'], 'apache') !== false) {
// add the contents of h5bp-htaccess into the .htaccess file
function roots_add_h5bp_htaccess($content) {
global $wp_rewrite;
if (!function_exists('get_home_path')) {
return;
}
$home_path = get_home_path();
$home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
$htaccess_file = $home_path . '.htaccess';
$mod_rewrite_enabled = function_exists('got_mod_rewrite') ? got_mod_rewrite() : false;
if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
if (got_mod_rewrite()) {
if ($mod_rewrite_enabled) {
$h5bp_rules = extract_from_markers($htaccess_file, 'HTML5 Boilerplate');
if ($h5bp_rules === array()) {
$filename = __DIR__ . '/h5bp-htaccess';