PluginProbe
WPPizza – A Restaurant Plugin / 3.20
WPPizza – A Restaurant Plugin v3.20
trunk 2.16.11.28 3.19 3.19.1 3.19.2 3.19.3 3.19.4 3.19.5 3.19.6 3.19.7 3.19.7.1 3.19.7.2 3.19.7.3 3.19.7.4 3.19.8 3.19.8.1 3.19.8.2 3.19.8.3 3.19.9 3.20 3.20.1
wppizza / classes / modules / mod.tools.sysinfo.phpinfo.php

mod.tools.sysinfo.phpinfo.php in WPPizza – A Restaurant Plugin 3.20, at classes/modules/mod.tools.sysinfo.phpinfo.php

182 lines 5.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPPIZZA_MODULE_TOOLS_SYSINFO_PHPINFO Class
4 *
5 * @package WPPIZZA
6 * @subpackage WPPIZZA_MODULE_TOOLS_SYSINFO_PHPINFO
7 * @copyright Copyright (c) 2015, Oliver Bach
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 3.0
10 *
11 */
12 if ( ! defined( 'ABSPATH' ) ) exit;/*Exit if accessed directly*/
13
14
15 /************************************************************************************************************************
16 *
17 *
18 *
19 *
20 *
21 *
22 ************************************************************************************************************************/
23 class WPPIZZA_MODULE_TOOLS_SYSINFO_PHPINFO{
24
25 private $settings_page = 'tools';/* which admin subpage (identified there by this->class_key) are we adding this to */
26 private $tab_key = 'sysinfo';/* must be unique within this admin page*/
27 private $section_key = 'phpinfo';
28
29 function __construct() {
30 /**********************************************************
31 [add settings to admin]
32 ***********************************************************/
33 if(is_admin()){
34 /*** add to a specific tab ***/
35 add_filter('wppizza_filter_admin_tabs_'.$this->settings_page.'', array($this, 'admin_tabs'), 30);
36 /* add admin options settings page*/
37 add_filter('wppizza_filter_settings_sections_'.$this->settings_page.'', array($this, 'admin_options_settings'), 30, 5);
38 /* add admin options settings page fields */
39 add_action('wppizza_admin_settings_section_fields_'.$this->settings_page.'', array($this, 'admin_options_fields_settings'), 10, 5);
40 /** admin ajax **/
41 add_action('wppizza_ajax_admin_'.$this->settings_page.'', array( $this, 'admin_ajax'));
42 }
43 }
44 /*******************************************************************************************************************************************************
45 *
46 * [admin ajax]
47 *
48 ********************************************************************************************************************************************************/
49 function admin_ajax($wppizza_options){
50
51 //need right caps for access
52 if( ! current_user_can('wppizza_cap_'.$this->settings_page.'')){
53 echo '<div class="wppizza-highlight">'.__('Access Denied', 'wppizza-admin').' ['.$this->tab_key.']</div>';
54 exit();
55 }
56
57 /******************************************************
58 [tools - get php info]
59 ******************************************************/
60 if($_POST['vars']['field']=='get-php-vars'){
61
62 /*
63 general configuration
64 */
65 ob_start();
66 phpinfo(INFO_GENERAL);
67 preg_match ('%<style type="text/css">(.*?)</style>.*?(<body>.*</body>)%s', ob_get_clean(), $matches);
68
69 echo "<div class='phpinfodisplay'><style type='text/css'>\n",
70 join("\n",
71 array_map( array($this,'map_php_info'), preg_split( '/\n/', $matches[1] ) )
72 ),
73 "</style>\n",
74 $matches[2],
75 "\n</div>\n";
76
77
78 /*
79 info configuration
80 */
81 ob_start();
82 phpinfo(INFO_CONFIGURATION);
83 preg_match ('%<style type="text/css">(.*?)</style>.*?(<body>.*</body>)%s', ob_get_clean(), $matches);
84
85 echo "<div class='phpinfodisplay'><style type='text/css'>\n",
86 join("\n",
87 array_map( array($this,'map_php_info'), preg_split( '/\n/', $matches[1] ) )
88 ),
89 "</style>\n",
90 $matches[2],
91 "\n</div>\n";
92
93 /*
94 modules and module settings
95 */
96 ob_start();
97 phpinfo(INFO_MODULES);
98 preg_match ('%<style type="text/css">(.*?)</style>.*?(<body>.*</body>)%s', ob_get_clean(), $matches);
99
100 echo "<div class='phpinfodisplay'><style type='text/css'>\n",
101 join("\n",
102 array_map( array($this,'map_php_info'), preg_split( '/\n/', $matches[1] ) )
103 ),
104 "</style>\n",
105 $matches[2],
106 "\n</div>\n";
107 exit();
108 }
109 }
110
111
112 /*------------------------------------------------------------------------------
113 #
114 #
115 # [helpers]
116 #
117 #
118 ------------------------------------------------------------------------------*/
119 function map_php_info($i){
120 return ".phpinfodisplay " . preg_replace( "/,/", ",.phpinfodisplay ", $i );
121 }
122 /*------------------------------------------------------------------------------
123 #
124 #
125 # [settings page]
126 #
127 #
128 ------------------------------------------------------------------------------*/
129 /*********************************************************
130 [add section to tab]
131 *********************************************************/
132 function admin_tabs($tabs){
133 $tabs['tab'][$this->tab_key]['sections'][] = $this->section_key;
134 return $tabs;
135 }
136 /*------------------------------------------------------------------------------
137 # [settings section - setting page]
138 # @since 3.0
139 # @return array()
140 ------------------------------------------------------------------------------*/
141 function admin_options_settings($settings, $sections, $fields, $inputs, $help){
142
143 /*section*/
144 if($sections){
145 $settings['sections'][$this->section_key] = __('PHP Configuration', 'wppizza-admin');
146 }
147
148 /*help*/
149 if($help){
150 }
151
152 /*fields*/
153 if($fields){
154 $field = 'php_config';
155 $settings['fields'][$this->section_key][$field] = array('' , array(
156 'value_key'=>$field,
157 'option_key'=>$this->settings_page,
158 'label'=>'',
159 'description'=>array()
160 ));
161 }
162 return $settings;
163 }
164 /*------------------------------------------------------------------------------
165 # [output option fields - setting page]
166 # @since 3.0
167 # @return array()
168 ------------------------------------------------------------------------------*/
169 function admin_options_fields_settings($wppizza_options, $options_key, $field, $label, $description){
170 if($field=='php_config'){
171 echo "<h2><a href='javascript:void(0)' id='wppizza_show_php_vars' class='button'>".__('show php configuration', 'wppizza-admin')."</a></h2>";
172 echo"<div id='wppizza_php_info'></div>";
173 }
174 }
175 }
176 /***************************************************************
177 *
178 * [ini]
179 *
180 ***************************************************************/
181 $WPPIZZA_MODULE_TOOLS_SYSINFO_PHPINFO = new WPPIZZA_MODULE_TOOLS_SYSINFO_PHPINFO();
182 ?>