PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.3.2
Adminify – White Label, Admin Menu Editor, Login Customizer v4.3.2
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 4.3.2, at Inc/Modules/ServerInformation/ServerInfo_PHP_INI_Details.php

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