# adminify/1.0.7/Inc/Modules/ServerInformation/ServerInfo_Htaccess_Details.php

Adminify – White Label, Admin Menu Editor, Login Customizer, version 1.0.7. 128 lines.

- Page: https://pluginprobe.com/plugins/adminify/1.0.7/code/Inc/Modules/ServerInformation/ServerInfo_Htaccess_Details.php
- Raw: https://pluginprobe.com/plugins/adminify/1.0.7/raw/Inc/Modules/ServerInformation/ServerInfo_Htaccess_Details.php
- Modified: 2021-11-24T08:01:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/adminify/1.0.7/code/Inc/Modules/ServerInformation/ServerInfo_Htaccess_Details.php#L10-L20`.

```php
<?php

namespace WPAdminify\Inc\Modules\ServerInformation;

use WPAdminify\Inc\Classes\ServerInfo;
use WPAdminify\Inc\Utils;

// no direct access allowed
if (!defined('ABSPATH'))  exit;

/**
 * WPAdminify
 * @package Server Information
 *
 * @author WP Adminify <support@wpadminify.com>
 */

class ServerInfo_Htaccess_Details
{

    public function __construct()
    {
        $this->init();
    }

    public function init()
    {
        $server_info = new ServerInfo();

        $help = '<span class="dashicons dashicons-editor-help"></span>';
        $enabled = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Enabled', WP_ADMINIFY_TD) . '</span>';
        $disabled = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('Disabled', WP_ADMINIFY_TD) . '</span>';
        $yes = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Yes', WP_ADMINIFY_TD) . '</span>';
        $no = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('No', WP_ADMINIFY_TD) . '</span>';
        $entered = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Defined', WP_ADMINIFY_TD) . '</span>';
        $not_entered = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('Not defined', WP_ADMINIFY_TD) . '</span>';
        $sec_key = '<span class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__('Please enter this security key in the wp-confiq.php file', WP_ADMINIFY_TD) . '!</span>';
?>
        <div class="wrap">
            <h1>
                <?php echo Utils::admin_page_title(esc_html__('.htaccess file', WP_ADMINIFY_TD)); ?>
            </h1>
        </div>

        <p style="color: #ce2754; font-weight: bold">
            <?php $name = '.htaccess';
            printf(wp_kses_post(__('For security reasons you can only read the %1$s file! Please connect to your server and modify the file in a file editor.', WP_ADMINIFY_TD)), $name); ?>
        </p>

        <p>
            <?php esc_html_e('The .htaccess is a distributed configuration file, and is how Apache server handles configuration changes on a per-directory basis.', WP_ADMINIFY_TD); ?>
            <br>
            <a href="https://wordpress.org/support/article/htaccess/" target="_blank" rel="noopener"><?php esc_html_e('Learn more about the .htaccess file in WordPress.', WP_ADMINIFY_TD); ?></a>
        </p>

        <?php

        // Get the wp ".htaccess" file
        $file = $this->jltwp_adminify_htaccess_file();

        // Get the wp ".htaccess" file content
        $file_content = $this->jltwp_adminify_htaccess_file_content($file);

        if ($file) { ?>
            <p>
                <?php echo esc_html__('.htaccess file was found at:', WP_ADMINIFY_TD) . ' <strong>' . esc_html($file) . '</strong>'; ?>
                <br>
            </p>
        <?php } ?>

        <textarea id="htaccess_log_area" class="adminify-info-text-area" readonly><?php echo esc_html($file_content); ?></textarea>

<?php
    }


    /**
     * htaccess file
     */
    public function jltwp_adminify_htaccess_file()
    {

        // Call wp file system
        global $wp_filesystem;
        WP_Filesystem();

        // Get the path of wp ".htaccess" file
        $file = get_home_path() . '.htaccess';

        // Check if ".htaccess" file exist
        if (
            $wp_filesystem->exists($file)
        ) {
            return $file;
        }

        // File not exist
        return false;
    }

    /**
     * .htaccess file contents
     */

    public function jltwp_adminify_htaccess_file_content($file)
    {

        // Call wp file system
        global $wp_filesystem;
        WP_Filesystem();

        // Show this notice, if no file exist
        $content = esc_html__('.htaccess file not found!', 'wphave-admin');

        // Check if ".htaccess" file exist
        if ($wp_filesystem->exists($file)) {
            $content = $wp_filesystem->get_contents($file);

            // Check if the file content is empty
            if ($wp_filesystem->get_contents($file) == '') {
                $content = esc_html__('File content is empty.', 'wphave-admin');
            }
        }

        return $content;
    }
}

```
