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_PHP_INI_Details.php

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

142 lines 4.6 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_PHP_INI_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
41 <h1>
42 <?php echo Utils::admin_page_title(esc_html__('PHP_INI_Details File', WP_ADMINIFY_TD)); ?>
43 </h1>
44
45 <p style="color: #ce2754; font-weight: bold">
46 <?php $name = 'php.ini';
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 <strong><?php esc_html_e('To affect your custom configuration in the php.ini file, you have to save the file in the "../wp-admin" folder.', WP_ADMINIFY_TD); ?></strong>
52 </p>
53
54 <p>
55 <?php esc_html_e("The PHP configuration file, php.ini, is the final and most immediate way to affect PHP's functionality. The php.ini file is read each time PHP is initialized.", WP_ADMINIFY_TD); ?>
56 <br>
57 <a href="https://www.php.net/manual/en/ini.core.php" target="_blank" rel="noopener"><?php esc_html_e('Learn more about the php.ini file.', WP_ADMINIFY_TD); ?></a>
58 </p>
59 </div>
60
61 <?php
62
63 // Get the wp "php.ini" file
64 $file = $this->jltwp_adminify_php_ini_file();
65
66 // Get the wp "php.ini" file content
67 $file_content = $this->jltwp_adminify_php_ini_file_content($file);
68
69 if ($file) { ?>
70 <p>
71 <?php echo esc_html__('php.ini file was found at:', WP_ADMINIFY_TD) . ' <strong>' . esc_html($file) . '</strong>'; ?>
72 <br>
73 </p>
74 <?php } ?>
75
76 <textarea id="php_ini_log_area" class="adminify-info-text-area" readonly><?php echo esc_html($file_content); ?></textarea>
77
78
79 <?php
80 }
81
82
83 /**
84 * PHP.ini file
85 *
86 * @return void
87 */
88 public function jltwp_adminify_php_ini_file()
89 {
90
91 // Call wp file system
92 global $wp_filesystem;
93 WP_Filesystem();
94
95 // Get the path of wp "php.ini" file
96 $file = get_home_path() . 'wp-admin/php.ini';
97
98 // Check if "php.ini" file exist
99 if (
100 $wp_filesystem->exists($file)
101 ) {
102 return $file;
103 }
104
105 // File not exist
106 return false;
107 }
108
109
110 /**
111 * PHP.ini File Contents
112 *
113 * @param [type] $file
114 *
115 * @return void
116 */
117 public function jltwp_adminify_php_ini_file_content($file)
118 {
119
120 // Call wp file system
121 global $wp_filesystem;
122 WP_Filesystem();
123
124 // Show this notice, if no file exist
125 $content = esc_html__('php.ini file not found!', WP_ADMINIFY_TD);
126
127 // Check if "php.ini" file exist
128 if (
129 $wp_filesystem->exists($file)
130 ) {
131 $content = $wp_filesystem->get_contents($file);
132
133 // Check if the file content is empty
134 if ($wp_filesystem->get_contents($file) == '') {
135 $content = esc_html__('File content is empty.', WP_ADMINIFY_TD);
136 }
137 }
138
139 return $content;
140 }
141 }
142