" . __( 'Settings' ) . ''; // Adds the link to the end of the array. array_push( $links, $settings_link ); return $links; } function advancedhtaccessoptimizer_disable_plugin_theme_editor() { $disable_editor_option = get_option('advancedhtaccessoptimizer_disable_plugin_theme_editor'); if ($disable_editor_option == 1) { define('DISALLOW_FILE_EDIT', true); remove_submenu_page('themes.php', 'theme-editor.php'); remove_submenu_page('plugins.php', 'plugin-editor.php'); } } add_action('admin_menu', 'advancedhtaccessoptimizer_disable_plugin_theme_editor', 1); function advancedhtaccessoptimizer_create_wp_content_htaccess() { $htaccess_file1 = WP_CONTENT_DIR . '/.htaccess'; $htaccess_content1 = "\ndeny from all\n"; $disable_php_option = get_option('advancedhtaccessoptimizer_disable_wpcontent_php'); $disable_php_option = filter_var($disable_php_option, FILTER_VALIDATE_BOOLEAN); if ($disable_php_option) { if (!file_exists($htaccess_file1)) { @file_put_contents($htaccess_file1, $htaccess_content1); } } else { if (file_exists($htaccess_file1)) { @unlink($htaccess_file1); } } } add_action('admin_init', 'advancedhtaccessoptimizer_create_wp_content_htaccess'); function advancedhtaccessoptimizer_create_wp_includes_htaccess() { if (defined('ABSPATH')) { $htaccess_file2 = ABSPATH . 'wp-includes/.htaccess'; } $htaccess_content2 = "\ndeny from all\n"; $disable_includes_php_option = get_option('advancedhtaccessoptimizer_disable_includes_php'); $disable_includes_php_option = filter_var($disable_includes_php_option, FILTER_VALIDATE_BOOLEAN); if ($disable_includes_php_option) { if (!file_exists($htaccess_file2)) { @file_put_contents($htaccess_file2, $htaccess_content2); } } else { if (file_exists($htaccess_file2)) { @unlink($htaccess_file2); } } } add_action('admin_init', 'advancedhtaccessoptimizer_create_wp_includes_htaccess'); function advancedhtaccessoptimizer_create_wp_uploads_htaccess() { if (defined('ABSPATH')) { $htaccess_file3 = ABSPATH . 'wp-content/uploads/.htaccess'; } $htaccess_content3 = "\ndeny from all\n"; $disable_uploads_php_option = get_option('advancedhtaccessoptimizer_disable_uploads_php'); $disable_uploads_php_option = filter_var($disable_uploads_php_option, FILTER_VALIDATE_BOOLEAN); if ($disable_uploads_php_option) { if (!file_exists($htaccess_file3)) { @file_put_contents($htaccess_file3, $htaccess_content3); } } else { if (file_exists($htaccess_file3)) { @unlink($htaccess_file3); } } } add_action('admin_init', 'advancedhtaccessoptimizer_create_wp_uploads_htaccess'); function advancedhtaccessoptimizer_replace_http_with_https($content) { $disable_mixed_content_option = get_option('advancedhtaccessoptimizer_disable_mixed_content'); $disable_mixed_content_option = filter_var($disable_mixed_content_option, FILTER_VALIDATE_BOOLEAN); if ($disable_mixed_content_option) { $content = str_replace("http://", "https://", $content); } return $content; } if (is_ssl()) { add_filter('the_content', 'advancedhtaccessoptimizer_replace_http_with_https'); add_filter('content_url', 'advancedhtaccessoptimizer_replace_http_with_https'); add_filter('plugins_url', 'advancedhtaccessoptimizer_replace_http_with_https'); add_filter('site_url', 'advancedhtaccessoptimizer_replace_http_with_https'); add_filter('stylesheet_directory_uri', 'advancedhtaccessoptimizer_replace_http_with_https'); add_filter('template_directory_uri', 'advancedhtaccessoptimizer_replace_http_with_https'); } function advancedhtaccessoptimizer_custom_login_error_messages() { if (get_option('advancedhtaccessoptimizer_prevent_exposed_login_feedback') == 1) { $error_message = esc_html__('ERROR', 'advancedhtaccessoptimizer'); $invalid_login_message = esc_html__('Invalid login credentials.', 'advancedhtaccessoptimizer'); return '' . $error_message . ': ' . $invalid_login_message; } } function advancedhtaccessoptimizer_clear_login_details_js() { $user_login_id = esc_attr('user_login'); $user_email_id = esc_attr('user_email'); $script = ''; echo $script; } function advancedhtaccessoptimizer_clear_login_details() { if (get_option('advancedhtaccessoptimizer_prevent_exposed_login_feedback') == 1) { add_action('login_head', 'advancedhtaccessoptimizer_clear_login_details_js'); add_filter('login_errors', 'advancedhtaccessoptimizer_custom_login_error_messages'); } } add_action('login_head', 'advancedhtaccessoptimizer_clear_login_details'); include_once(plugin_dir_path(__FILE__) . "/includes/htaccessincludes.php"); include_once(plugin_dir_path(__FILE__) . "/includes/htaccess-optimizer.php");