PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.7
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.7
4.3.2 4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 All 165 releases
adminify / Inc / Modules / ServerInformation / ServerInfo_Htaccess_Details.php

ServerInfo_Htaccess_Details.php in Adminify – White Label, Admin Menu Editor, Login Customizer 1.0.7, at Inc/Modules/ServerInformation/ServerInfo_Htaccess_Details.php

128 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Modules\ServerInformation;
4
5 use WPAdminify\Inc\Classes\ServerInfo;
6 use WPAdminify\Inc\Utils;
7
8 // no direct access allowed
9 if (!defined('ABSPATH')) exit;
10
11 /**
12 * WPAdminify
13 * @package Server Information
14 *
15 * @author WP Adminify <support@wpadminify.com>
16 */
17
18 class ServerInfo_Htaccess_Details
19 {
20
21 public function __construct()
22 {
23 $this->init();
24 }
25
26 public function init()
27 {
28 $server_info = new ServerInfo();
29
30 $help = '<span class="dashicons dashicons-editor-help"></span>';
31 $enabled = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Enabled', WP_ADMINIFY_TD) . '</span>';
32 $disabled = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('Disabled', WP_ADMINIFY_TD) . '</span>';
33 $yes = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Yes', WP_ADMINIFY_TD) . '</span>';
34 $no = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('No', WP_ADMINIFY_TD) . '</span>';
35 $entered = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__('Defined', WP_ADMINIFY_TD) . '</span>';
36 $not_entered = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__('Not defined', WP_ADMINIFY_TD) . '</span>';
37 $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>';
38 ?>
39 <div class="wrap">
40 <h1>
41 <?php echo Utils::admin_page_title(esc_html__('.htaccess file', WP_ADMINIFY_TD)); ?>
42 </h1>
43 </div>
44
45 <p style="color: #ce2754; font-weight: bold">
46 <?php $name = '.htaccess';
47 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); ?>
48 </p>
49
50 <p>
51 <?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); ?>
52 <br>
53 <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>
54 </p>
55
56 <?php
57
58 // Get the wp ".htaccess" file
59 $file = $this->jltwp_adminify_htaccess_file();
60
61 // Get the wp ".htaccess" file content
62 $file_content = $this->jltwp_adminify_htaccess_file_content($file);
63
64 if ($file) { ?>
65 <p>
66 <?php echo esc_html__('.htaccess file was found at:', WP_ADMINIFY_TD) . ' <strong>' . esc_html($file) . '</strong>'; ?>
67 <br>
68 </p>
69 <?php } ?>
70
71 <textarea id="htaccess_log_area" class="adminify-info-text-area" readonly><?php echo esc_html($file_content); ?></textarea>
72
73 <?php
74 }
75
76
77 /**
78 * htaccess file
79 */
80 public function jltwp_adminify_htaccess_file()
81 {
82
83 // Call wp file system
84 global $wp_filesystem;
85 WP_Filesystem();
86
87 // Get the path of wp ".htaccess" file
88 $file = get_home_path() . '.htaccess';
89
90 // Check if ".htaccess" file exist
91 if (
92 $wp_filesystem->exists($file)
93 ) {
94 return $file;
95 }
96
97 // File not exist
98 return false;
99 }
100
101 /**
102 * .htaccess file contents
103 */
104
105 public function jltwp_adminify_htaccess_file_content($file)
106 {
107
108 // Call wp file system
109 global $wp_filesystem;
110 WP_Filesystem();
111
112 // Show this notice, if no file exist
113 $content = esc_html__('.htaccess file not found!', 'wphave-admin');
114
115 // Check if ".htaccess" file exist
116 if ($wp_filesystem->exists($file)) {
117 $content = $wp_filesystem->get_contents($file);
118
119 // Check if the file content is empty
120 if ($wp_filesystem->get_contents($file) == '') {
121 $content = esc_html__('File content is empty.', 'wphave-admin');
122 }
123 }
124
125 return $content;
126 }
127 }
128