Version Description
- (NEW) Added checkboxes to allow bulk copy of directives to editor
- (NEW) Added a search box to search for PHP directives (based on the great list.js script)
- (IMPROVE) Improved security in AJAX calls
Download this release
Release Info
Developer | Askupa Software |
Plugin | PHP Settings |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- assets/css/style.css +82 -18
- assets/js/process-button.js +2 -2
- assets/js/script.js +124 -19
- bootstrap.php +2 -2
- includes/EnvironmentValidator.php +2 -2
- includes/INIFile.php +2 -2
- includes/PHPInfo.php +4 -2
- includes/PHPSettings.php +20 -8
- readme.txt +10 -3
- view/options-page.phtml +17 -3
- view/phpinfo.phtml +14 -20
- view/social.phtml +8 -0
assets/css/style.css
CHANGED
@@ -175,48 +175,60 @@
|
|
175 |
#phpinfo {
|
176 |
background-color: #CCCCCC;
|
177 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
|
180 |
-
#phpinfo
|
181 |
-
#phpinfo
|
|
|
182 |
{
|
183 |
background-color: #6AFDB2;
|
|
|
184 |
}
|
185 |
|
186 |
-
#phpinfo
|
187 |
background-color: #FFEA56;
|
188 |
padding: 2px 6px;
|
189 |
border-radius: 4px;
|
190 |
float: right;
|
191 |
}
|
192 |
|
193 |
-
#phpinfo
|
194 |
-
|
195 |
-
|
196 |
-
height: auto;
|
197 |
-
float: right;
|
198 |
-
font-size: 11px;
|
199 |
-
}
|
200 |
-
|
201 |
-
#phpinfo tr:not(.local-override):hover td,
|
202 |
-
#phpinfo tr:not(.local-override):hover th {
|
203 |
background-color: white;
|
204 |
cursor: pointer;
|
205 |
}
|
206 |
|
207 |
-
#phpinfo
|
208 |
-
display:
|
|
|
|
|
209 |
}
|
210 |
|
211 |
-
#phpinfo
|
212 |
background-color: #F1F1F1;
|
213 |
padding: 3px 6px;
|
214 |
text-align: left;
|
|
|
215 |
}
|
216 |
|
217 |
-
#phpinfo
|
218 |
background-color: #F1F1F1;
|
219 |
padding: 3px 6px;
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
}
|
221 |
|
222 |
#phpinfo-wrapper {
|
@@ -226,6 +238,52 @@
|
|
226 |
border: 1px solid #CCCCCC;
|
227 |
}
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
/*-------------------------------*\
|
230 |
* Misc
|
231 |
\*-------------------------------*/
|
@@ -255,11 +313,17 @@
|
|
255 |
vertical-align: middle;
|
256 |
color: #485254;
|
257 |
border-left: 8px solid #ED7964;
|
258 |
-
padding:
|
259 |
line-height: 0.9em;
|
260 |
}
|
261 |
|
262 |
.plugin-banner h1 span {
|
263 |
color: #AFAFAF;
|
264 |
font-size: 0.6em;
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
}
|
175 |
#phpinfo {
|
176 |
background-color: #CCCCCC;
|
177 |
width: 100%;
|
178 |
+
display: table;
|
179 |
+
margin:0;
|
180 |
+
padding:0;
|
181 |
+
border-spacing: 1px;
|
182 |
+
}
|
183 |
+
|
184 |
+
#phpinfo li {
|
185 |
+
display: table-row;
|
186 |
}
|
187 |
|
188 |
+
#phpinfo li.local-override .list-checkbox,
|
189 |
+
#phpinfo li.local-override .list-key,
|
190 |
+
#phpinfo li.local-override .list-value
|
191 |
{
|
192 |
background-color: #6AFDB2;
|
193 |
+
vertical-align: middle;
|
194 |
}
|
195 |
|
196 |
+
#phpinfo li.local-override .highlight {
|
197 |
background-color: #FFEA56;
|
198 |
padding: 2px 6px;
|
199 |
border-radius: 4px;
|
200 |
float: right;
|
201 |
}
|
202 |
|
203 |
+
#phpinfo li:not(.local-override):hover .list-checkbox,
|
204 |
+
#phpinfo li:not(.local-override):hover .list-key,
|
205 |
+
#phpinfo li:not(.local-override):hover .list-value {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
background-color: white;
|
207 |
cursor: pointer;
|
208 |
}
|
209 |
|
210 |
+
#phpinfo .list-checkbox {
|
211 |
+
display: table-cell;
|
212 |
+
background-color: #F1F1F1;
|
213 |
+
text-align: center;
|
214 |
}
|
215 |
|
216 |
+
#phpinfo .list-key {
|
217 |
background-color: #F1F1F1;
|
218 |
padding: 3px 6px;
|
219 |
text-align: left;
|
220 |
+
display: table-cell;
|
221 |
}
|
222 |
|
223 |
+
#phpinfo .list-value {
|
224 |
background-color: #F1F1F1;
|
225 |
padding: 3px 6px;
|
226 |
+
display: table-cell;
|
227 |
+
}
|
228 |
+
|
229 |
+
#phpinfo .list-checkbox input {
|
230 |
+
margin: 0;
|
231 |
+
margin-bottom: 2px;
|
232 |
}
|
233 |
|
234 |
#phpinfo-wrapper {
|
238 |
border: 1px solid #CCCCCC;
|
239 |
}
|
240 |
|
241 |
+
input.search {
|
242 |
+
background-color: white;
|
243 |
+
margin: 0 0 15px;
|
244 |
+
padding: 7px 10px;
|
245 |
+
width: 50%;
|
246 |
+
outline: none;
|
247 |
+
border: 1px solid #CCCCCC;
|
248 |
+
}
|
249 |
+
|
250 |
+
#copy-directives {
|
251 |
+
padding: 2px 11px;
|
252 |
+
height: auto;
|
253 |
+
margin-left: 10px;
|
254 |
+
}
|
255 |
+
|
256 |
+
#copy-directives .dashicons {
|
257 |
+
vertical-align: middle;
|
258 |
+
line-height: 16px;
|
259 |
+
margin-left: -4px;
|
260 |
+
}
|
261 |
+
|
262 |
+
#directive-counter {
|
263 |
+
display: inline;
|
264 |
+
margin-left: 10px;
|
265 |
+
color: gray;
|
266 |
+
}
|
267 |
+
|
268 |
+
#search-wrapper {
|
269 |
+
display: inline;
|
270 |
+
position: relative;
|
271 |
+
}
|
272 |
+
|
273 |
+
#search-wrapper .dashicons-dismiss {
|
274 |
+
position: absolute;
|
275 |
+
right: 10px;
|
276 |
+
top: 0;
|
277 |
+
bottom: 0;
|
278 |
+
color: #CCCCCC;
|
279 |
+
cursor: pointer;
|
280 |
+
display: none;
|
281 |
+
}
|
282 |
+
|
283 |
+
#search-wrapper .dashicons-dismiss:hover {
|
284 |
+
color: #888;
|
285 |
+
}
|
286 |
+
|
287 |
/*-------------------------------*\
|
288 |
* Misc
|
289 |
\*-------------------------------*/
|
313 |
vertical-align: middle;
|
314 |
color: #485254;
|
315 |
border-left: 8px solid #ED7964;
|
316 |
+
padding: 10px 0 10px 25px;
|
317 |
line-height: 0.9em;
|
318 |
}
|
319 |
|
320 |
.plugin-banner h1 span {
|
321 |
color: #AFAFAF;
|
322 |
font-size: 0.6em;
|
323 |
+
}
|
324 |
+
|
325 |
+
.social-buttons {
|
326 |
+
display: inline-block;
|
327 |
+
margin: 10px 0 0;
|
328 |
+
height: 21px;
|
329 |
}
|
assets/js/process-button.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/**
|
2 |
* @package PHP Settings
|
3 |
-
* @date 2016-04-
|
4 |
-
* @version 1.0.
|
5 |
* @author Askupa Software <contact@askupasoftware.com>
|
6 |
* @link http://products.askupasoftware.com/php-settings
|
7 |
* @copyright 2016 Askupa Software
|
1 |
/**
|
2 |
* @package PHP Settings
|
3 |
+
* @date 2016-04-24
|
4 |
+
* @version 1.0.4
|
5 |
* @author Askupa Software <contact@askupasoftware.com>
|
6 |
* @link http://products.askupasoftware.com/php-settings
|
7 |
* @copyright 2016 Askupa Software
|
assets/js/script.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/**
|
2 |
* @package PHP Settings
|
3 |
-
* @date 2016-04-
|
4 |
-
* @version 1.0.
|
5 |
* @author Askupa Software <contact@askupasoftware.com>
|
6 |
* @link http://products.askupasoftware.com/php-settings
|
7 |
* @copyright 2016 Askupa Software
|
@@ -18,13 +18,14 @@ jQuery(document).ready(function($) {
|
|
18 |
ajaxurl, // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
19 |
{
|
20 |
'action': 'save_php_settings',
|
|
|
21 |
'ini_settings': editor.getValue()
|
22 |
},
|
23 |
function(response) {
|
24 |
-
if(
|
25 |
else
|
26 |
{
|
27 |
-
notify(response, 'error');
|
28 |
self.abort();
|
29 |
}
|
30 |
}
|
@@ -36,17 +37,18 @@ jQuery(document).ready(function($) {
|
|
36 |
$.post(
|
37 |
ajaxurl, // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
38 |
{
|
|
|
39 |
'action': 'delete_ini_files'
|
40 |
},
|
41 |
function(response) {
|
42 |
-
if(
|
43 |
{
|
44 |
self.done();
|
45 |
editor.setValue('',1);
|
46 |
}
|
47 |
else
|
48 |
{
|
49 |
-
notify(response, 'error');
|
50 |
self.abort();
|
51 |
}
|
52 |
}
|
@@ -58,11 +60,22 @@ jQuery(document).ready(function($) {
|
|
58 |
$.post(
|
59 |
ajaxurl, // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
60 |
{
|
|
|
61 |
'action': 'refresh_table'
|
62 |
},
|
63 |
function(response) {
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
);
|
68 |
});
|
@@ -81,17 +94,6 @@ jQuery(document).ready(function($) {
|
|
81 |
$('[href="'+id+'"]').addClass('nav-tab-active');
|
82 |
}
|
83 |
|
84 |
-
function copy_directive()
|
85 |
-
{
|
86 |
-
var directive = $(this).children('th').text(),
|
87 |
-
value = $(this).find('td .value').text();
|
88 |
-
|
89 |
-
editor.setValue(editor.getValue() + '\n'+directive+' = '+value, 1);
|
90 |
-
show_tab( '#tab1' );
|
91 |
-
editor.focus();
|
92 |
-
}
|
93 |
-
$('#phpinfo-wrapper').on('click','#phpinfo tr',copy_directive);
|
94 |
-
|
95 |
function notify( message, type )
|
96 |
{
|
97 |
var $notification = $('<div>').addClass('nav-tab-notification nav-tab-'+type),
|
@@ -99,4 +101,107 @@ jQuery(document).ready(function($) {
|
|
99 |
$text = $('<p>').html(message);
|
100 |
$('.nav-tab-notifications').html($notification.append($icon,$text));
|
101 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
});
|
1 |
/**
|
2 |
* @package PHP Settings
|
3 |
+
* @date 2016-04-24
|
4 |
+
* @version 1.0.4
|
5 |
* @author Askupa Software <contact@askupasoftware.com>
|
6 |
* @link http://products.askupasoftware.com/php-settings
|
7 |
* @copyright 2016 Askupa Software
|
18 |
ajaxurl, // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
19 |
{
|
20 |
'action': 'save_php_settings',
|
21 |
+
'nonce': php_settings.nonce,
|
22 |
'ini_settings': editor.getValue()
|
23 |
},
|
24 |
function(response) {
|
25 |
+
if( response.success ) self.done();
|
26 |
else
|
27 |
{
|
28 |
+
notify(response.data, 'error');
|
29 |
self.abort();
|
30 |
}
|
31 |
}
|
37 |
$.post(
|
38 |
ajaxurl, // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
39 |
{
|
40 |
+
'nonce': php_settings.nonce,
|
41 |
'action': 'delete_ini_files'
|
42 |
},
|
43 |
function(response) {
|
44 |
+
if( response.success )
|
45 |
{
|
46 |
self.done();
|
47 |
editor.setValue('',1);
|
48 |
}
|
49 |
else
|
50 |
{
|
51 |
+
notify(response.data, 'error');
|
52 |
self.abort();
|
53 |
}
|
54 |
}
|
60 |
$.post(
|
61 |
ajaxurl, // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
62 |
{
|
63 |
+
'nonce': php_settings.nonce,
|
64 |
'action': 'refresh_table'
|
65 |
},
|
66 |
function(response) {
|
67 |
+
if( response.success )
|
68 |
+
{
|
69 |
+
$('#phpinfo-wrapper').html(response.data);
|
70 |
+
PHPInfo.clearSelection();
|
71 |
+
PHPInfo.updateListJs();
|
72 |
+
self.done();
|
73 |
+
}
|
74 |
+
else
|
75 |
+
{
|
76 |
+
notify('Unable to refresh table', 'error');
|
77 |
+
self.abort();
|
78 |
+
}
|
79 |
}
|
80 |
);
|
81 |
});
|
94 |
$('[href="'+id+'"]').addClass('nav-tab-active');
|
95 |
}
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
function notify( message, type )
|
98 |
{
|
99 |
var $notification = $('<div>').addClass('nav-tab-notification nav-tab-'+type),
|
101 |
$text = $('<p>').html(message);
|
102 |
$('.nav-tab-notifications').html($notification.append($icon,$text));
|
103 |
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* PHP Info table utility class
|
107 |
+
*/
|
108 |
+
function PHPInfo () {};
|
109 |
+
|
110 |
+
PHPInfo.clipboard = [];
|
111 |
+
PHPInfo.listJs;
|
112 |
+
|
113 |
+
PHPInfo.init = function()
|
114 |
+
{
|
115 |
+
$('#copy-directives').on('click', PHPInfo.copyDirectives);
|
116 |
+
$('#search-wrapper .dashicons-dismiss').on('click', PHPInfo.clearSearch);
|
117 |
+
$('#search-wrapper input').on('keyup', PHPInfo.onSearchKeyup);
|
118 |
+
$('#phpinfo-wrapper').on('click','#phpinfo li',PHPInfo.onDirectiveClick);
|
119 |
+
PHPInfo.updateListJs();
|
120 |
+
PHPInfo.updateCounter();
|
121 |
+
};
|
122 |
+
|
123 |
+
PHPInfo.copyDirectives = function()
|
124 |
+
{
|
125 |
+
if(0 === PHPInfo.clipboard.length) return;
|
126 |
+
|
127 |
+
var directives = PHPInfo.clipboard.map(function(e){return e.value;}).join('\n'),
|
128 |
+
content = editor.getValue();
|
129 |
+
|
130 |
+
if(content.trim() !== '') content += '\n';
|
131 |
+
editor.setValue(content+directives, 1);
|
132 |
+
show_tab( '#tab1' );
|
133 |
+
editor.focus();
|
134 |
+
PHPInfo.clearSelection();
|
135 |
+
}
|
136 |
+
|
137 |
+
PHPInfo.onDirectiveClick = function(e)
|
138 |
+
{
|
139 |
+
var checkbox = $(this).find('.list-checkbox input'),
|
140 |
+
id = checkbox.val(),
|
141 |
+
directive = $(this).children('.list-key').text()+' = '+$(this).find('.list-value .value').text(),
|
142 |
+
checked = checkbox.prop("checked");
|
143 |
+
|
144 |
+
// Toggle checkbox if not clicking on the checkbox itself
|
145 |
+
if( !$(e.target).is('input') ) checkbox.prop("checked", !checked);
|
146 |
+
|
147 |
+
// Add/remove directive from clipboard
|
148 |
+
if( !checked ) PHPInfo.addToClipboard(id, directive);
|
149 |
+
else PHPInfo.removeFromClipboard(id);
|
150 |
+
|
151 |
+
PHPInfo.updateCounter();
|
152 |
+
};
|
153 |
+
|
154 |
+
PHPInfo.onSearchKeyup = function()
|
155 |
+
{
|
156 |
+
var $input = $(this),
|
157 |
+
$clear = $input.parent().children('.dashicons-dismiss');
|
158 |
+
if($input.val() === '') $clear.hide();
|
159 |
+
else $clear.show();
|
160 |
+
};
|
161 |
+
|
162 |
+
PHPInfo.clearSelection = function()
|
163 |
+
{
|
164 |
+
$('#phpinfo .list-checkbox input:checked').each(function(){
|
165 |
+
$(this).prop("checked", false);
|
166 |
+
});
|
167 |
+
PHPInfo.clipboard = [];
|
168 |
+
PHPInfo.updateCounter();
|
169 |
+
};
|
170 |
+
|
171 |
+
PHPInfo.clearSearch = function()
|
172 |
+
{
|
173 |
+
var $input = $('#search-wrapper input');
|
174 |
+
$input.val('');
|
175 |
+
// Must use dispatch event to make list.js refresh
|
176 |
+
$input[0].dispatchEvent(new KeyboardEvent("keyup"));
|
177 |
+
};
|
178 |
+
|
179 |
+
PHPInfo.addToClipboard = function(id, value)
|
180 |
+
{
|
181 |
+
PHPInfo.clipboard.push({id: id, value: value});
|
182 |
+
};
|
183 |
+
|
184 |
+
PHPInfo.removeFromClipboard = function(id)
|
185 |
+
{
|
186 |
+
for( var i = 0; i < PHPInfo.clipboard.length; i++)
|
187 |
+
{
|
188 |
+
if( PHPInfo.clipboard[i].id === id )
|
189 |
+
{
|
190 |
+
PHPInfo.clipboard.splice(i, 1);
|
191 |
+
break;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
};
|
195 |
+
|
196 |
+
PHPInfo.updateListJs = function()
|
197 |
+
{
|
198 |
+
PHPInfo.listJs = new List('directives', {valueNames: [ 'list-key', 'list-value' ]});
|
199 |
+
};
|
200 |
+
|
201 |
+
PHPInfo.updateCounter = function()
|
202 |
+
{
|
203 |
+
$('#directive-counter').text(PHPInfo.clipboard.length+' directives selected');
|
204 |
+
};
|
205 |
+
|
206 |
+
PHPInfo.init();
|
207 |
});
|
bootstrap.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
* Plugin Name: PHP Settings
|
14 |
* Plugin URI: http://products.askupasoftware.com/php-settings
|
15 |
* Description: This plugin provides a simple user interface with a code editor to edit your local php.ini settings.
|
16 |
-
* Version: 1.0.
|
17 |
* Author: Askupa Software
|
18 |
* Author URI: http://www.askupasoftware.com
|
19 |
* Text Domain: php-settings
|
@@ -22,7 +22,7 @@
|
|
22 |
|
23 |
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
24 |
|
25 |
-
define( 'PHP_SETTINGS_VERSION', '1.0.
|
26 |
define( 'PHP_SETTINGS_JS_URL', plugins_url( '/assets/js/', __FILE__ ) );
|
27 |
define( 'PHP_SETTINGS_CSS_URL', plugins_url( '/assets/css/', __FILE__ ) );
|
28 |
define( 'PHP_SETTINGS_IMG_URL', plugins_url( '/assets/img/', __FILE__ ) );
|
13 |
* Plugin Name: PHP Settings
|
14 |
* Plugin URI: http://products.askupasoftware.com/php-settings
|
15 |
* Description: This plugin provides a simple user interface with a code editor to edit your local php.ini settings.
|
16 |
+
* Version: 1.0.4
|
17 |
* Author: Askupa Software
|
18 |
* Author URI: http://www.askupasoftware.com
|
19 |
* Text Domain: php-settings
|
22 |
|
23 |
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
24 |
|
25 |
+
define( 'PHP_SETTINGS_VERSION', '1.0.4' );
|
26 |
define( 'PHP_SETTINGS_JS_URL', plugins_url( '/assets/js/', __FILE__ ) );
|
27 |
define( 'PHP_SETTINGS_CSS_URL', plugins_url( '/assets/css/', __FILE__ ) );
|
28 |
define( 'PHP_SETTINGS_IMG_URL', plugins_url( '/assets/img/', __FILE__ ) );
|
includes/EnvironmentValidator.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package PHP Settings
|
4 |
-
* @date 2016-04-
|
5 |
-
* @version 1.0.
|
6 |
* @author Askupa Software <contact@askupasoftware.com>
|
7 |
* @link http://products.askupasoftware.com/php-settings
|
8 |
* @copyright 2016 Askupa Software
|
1 |
<?php
|
2 |
/**
|
3 |
* @package PHP Settings
|
4 |
+
* @date 2016-04-24
|
5 |
+
* @version 1.0.4
|
6 |
* @author Askupa Software <contact@askupasoftware.com>
|
7 |
* @link http://products.askupasoftware.com/php-settings
|
8 |
* @copyright 2016 Askupa Software
|
includes/INIFile.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package PHP Settings
|
4 |
-
* @date 2016-04-
|
5 |
-
* @version 1.0.
|
6 |
* @author Askupa Software <contact@askupasoftware.com>
|
7 |
* @link http://products.askupasoftware.com/php-settings
|
8 |
* @copyright 2016 Askupa Software
|
1 |
<?php
|
2 |
/**
|
3 |
* @package PHP Settings
|
4 |
+
* @date 2016-04-24
|
5 |
+
* @version 1.0.4
|
6 |
* @author Askupa Software <contact@askupasoftware.com>
|
7 |
* @link http://products.askupasoftware.com/php-settings
|
8 |
* @copyright 2016 Askupa Software
|
includes/PHPInfo.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package PHP Settings
|
4 |
-
* @date 2016-04-
|
5 |
-
* @version 1.0.
|
6 |
* @author Askupa Software <contact@askupasoftware.com>
|
7 |
* @link http://products.askupasoftware.com/php-settings
|
8 |
* @copyright 2016 Askupa Software
|
@@ -64,6 +64,8 @@ class PHPInfo
|
|
64 |
{
|
65 |
$array = self::get_as_array();
|
66 |
$phpinfo_section = $array[$section];
|
|
|
67 |
include( dirname( __DIR__ ).'/view/phpinfo.phtml' );
|
|
|
68 |
}
|
69 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* @package PHP Settings
|
4 |
+
* @date 2016-04-24
|
5 |
+
* @version 1.0.4
|
6 |
* @author Askupa Software <contact@askupasoftware.com>
|
7 |
* @link http://products.askupasoftware.com/php-settings
|
8 |
* @copyright 2016 Askupa Software
|
64 |
{
|
65 |
$array = self::get_as_array();
|
66 |
$phpinfo_section = $array[$section];
|
67 |
+
ob_start();
|
68 |
include( dirname( __DIR__ ).'/view/phpinfo.phtml' );
|
69 |
+
return ob_get_clean();
|
70 |
}
|
71 |
}
|
includes/PHPSettings.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package PHP Settings
|
4 |
-
* @date 2016-04-
|
5 |
-
* @version 1.0.
|
6 |
* @author Askupa Software <contact@askupasoftware.com>
|
7 |
* @link http://products.askupasoftware.com/php-settings
|
8 |
* @copyright 2016 Askupa Software
|
@@ -39,31 +39,36 @@ class PHPSettings
|
|
39 |
}
|
40 |
|
41 |
function save()
|
42 |
-
{
|
|
|
43 |
$content = filter_input( INPUT_POST, 'ini_settings' );
|
44 |
try {
|
|
|
45 |
INIFile::set_content( $content );
|
46 |
-
|
47 |
} catch (Exception $ex) {
|
48 |
-
|
49 |
}
|
50 |
wp_die();
|
51 |
}
|
52 |
|
53 |
function delete()
|
54 |
{
|
|
|
55 |
try {
|
|
|
56 |
INIFile::remove_files();
|
57 |
-
|
58 |
} catch (Exception $ex) {
|
59 |
-
|
60 |
}
|
61 |
wp_die();
|
62 |
}
|
63 |
|
64 |
function refresh_table()
|
65 |
{
|
66 |
-
|
|
|
67 |
wp_die();
|
68 |
}
|
69 |
|
@@ -72,6 +77,11 @@ class PHPSettings
|
|
72 |
include(dirname( __DIR__ ).'/view/options-page.phtml');
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
75 |
function enqueue_scripts( $hook )
|
76 |
{
|
77 |
if( 'tools_page_php_settings' === $hook )
|
@@ -79,6 +89,8 @@ class PHPSettings
|
|
79 |
wp_enqueue_script( 'php-settings-callback', PHP_SETTINGS_JS_URL.'script.js', array('jquery'), PHP_SETTINGS_VERSION );
|
80 |
wp_enqueue_script( 'process-button', PHP_SETTINGS_JS_URL.'process-button.js', array('jquery'), PHP_SETTINGS_VERSION );
|
81 |
wp_enqueue_script( 'ace-editor', 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js', array('jquery'), '1.2.3' );
|
|
|
|
|
82 |
wp_enqueue_style( 'php-settings', PHP_SETTINGS_CSS_URL.'style.css', array(), PHP_SETTINGS_VERSION );
|
83 |
add_filter('admin_footer_text', array( $this, 'footer_text' ) );
|
84 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* @package PHP Settings
|
4 |
+
* @date 2016-04-24
|
5 |
+
* @version 1.0.4
|
6 |
* @author Askupa Software <contact@askupasoftware.com>
|
7 |
* @link http://products.askupasoftware.com/php-settings
|
8 |
* @copyright 2016 Askupa Software
|
39 |
}
|
40 |
|
41 |
function save()
|
42 |
+
{
|
43 |
+
check_ajax_referer( 'ajax_validation', 'nonce' );
|
44 |
$content = filter_input( INPUT_POST, 'ini_settings' );
|
45 |
try {
|
46 |
+
if( !current_user_can( 'manage-options' ) ) throw new Exception('You do not have sufficient privileges to create/save files');
|
47 |
INIFile::set_content( $content );
|
48 |
+
wp_send_json_success();
|
49 |
} catch (Exception $ex) {
|
50 |
+
wp_send_json_error($ex->getMessage());
|
51 |
}
|
52 |
wp_die();
|
53 |
}
|
54 |
|
55 |
function delete()
|
56 |
{
|
57 |
+
check_ajax_referer( 'ajax_validation', 'nonce' );
|
58 |
try {
|
59 |
+
if( !current_user_can( 'manage-options' ) ) throw new Exception('You do not have sufficient privileges to delete files');
|
60 |
INIFile::remove_files();
|
61 |
+
wp_send_json_success();
|
62 |
} catch (Exception $ex) {
|
63 |
+
wp_send_json_error($ex->getMessage());
|
64 |
}
|
65 |
wp_die();
|
66 |
}
|
67 |
|
68 |
function refresh_table()
|
69 |
{
|
70 |
+
check_ajax_referer( 'ajax_validation', 'nonce' );
|
71 |
+
wp_send_json_success(PHPInfo::render('Core'));
|
72 |
wp_die();
|
73 |
}
|
74 |
|
77 |
include(dirname( __DIR__ ).'/view/options-page.phtml');
|
78 |
}
|
79 |
|
80 |
+
function render_social_buttons()
|
81 |
+
{
|
82 |
+
include(dirname( __DIR__ ).'/view/social.phtml');
|
83 |
+
}
|
84 |
+
|
85 |
function enqueue_scripts( $hook )
|
86 |
{
|
87 |
if( 'tools_page_php_settings' === $hook )
|
89 |
wp_enqueue_script( 'php-settings-callback', PHP_SETTINGS_JS_URL.'script.js', array('jquery'), PHP_SETTINGS_VERSION );
|
90 |
wp_enqueue_script( 'process-button', PHP_SETTINGS_JS_URL.'process-button.js', array('jquery'), PHP_SETTINGS_VERSION );
|
91 |
wp_enqueue_script( 'ace-editor', 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js', array('jquery'), '1.2.3' );
|
92 |
+
wp_enqueue_script( 'listjs', 'https://cdnjs.cloudflare.com/ajax/libs/list.js/1.2.0/list.min.js', array(), '1.2.0' );
|
93 |
+
wp_localize_script( 'php-settings-callback', 'php_settings', array('nonce' => wp_create_nonce( 'ajax_validation' ) ) );
|
94 |
wp_enqueue_style( 'php-settings', PHP_SETTINGS_CSS_URL.'style.css', array(), PHP_SETTINGS_VERSION );
|
95 |
add_filter('admin_footer_text', array( $this, 'footer_text' ) );
|
96 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Askupa Software
|
|
3 |
Tags: admin, php settings, user.ini, ini rules, php.ini, php5.ini, post max size, post_max_size, upload limit, upload max filesize, upload_max_filesize, max_execution_time, max execution time
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.5.0
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -17,15 +17,17 @@ Clicking on "Save Settings" creates 3 files: `.user.ini`, `php.ini` and `php5.in
|
|
17 |
|
18 |
The plugin also features a table containing a list of all the core PHP settings and their active values.
|
19 |
Settings that are successfully overridden become highlighted in the table.
|
20 |
-
Additionally, you can click on any one of the settings in the table
|
21 |
This makes it extremely easy to add or remove directives in a local `.ini` file.
|
|
|
22 |
|
23 |
**Features**
|
24 |
|
25 |
* Code editor with syntax highlighting
|
26 |
* A table showing all PHP core settings and their values
|
|
|
27 |
* Settings that are locally overridden become highlighted in the table
|
28 |
-
* Click on any setting field in the table to
|
29 |
* Save the settings to local `.ini` files asynchronously (no page reload)
|
30 |
* Delete local `.ini` files created by the plugin
|
31 |
* Refresh the PHP settings table asynchronously (no page reload)
|
@@ -69,6 +71,11 @@ This can happen for multiple reasons.
|
|
69 |
|
70 |
== Changelog ==
|
71 |
|
|
|
|
|
|
|
|
|
|
|
72 |
= 1.0.3 =
|
73 |
* (NEW) Added a link to the PHP settings page in the plugins page
|
74 |
* (FIX) Locally overridden directives are now copied properly to the editor
|
3 |
Tags: admin, php settings, user.ini, ini rules, php.ini, php5.ini, post max size, post_max_size, upload limit, upload max filesize, upload_max_filesize, max_execution_time, max execution time
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.5.0
|
6 |
+
Stable tag: 1.0.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
17 |
|
18 |
The plugin also features a table containing a list of all the core PHP settings and their active values.
|
19 |
Settings that are successfully overridden become highlighted in the table.
|
20 |
+
Additionally, you can click on any one of the settings in the table and copy it to the editor.
|
21 |
This makes it extremely easy to add or remove directives in a local `.ini` file.
|
22 |
+
Finally, a search box is built into the settings table to allow you to search for PHP directives to easily see their current value or copy them to the editor.
|
23 |
|
24 |
**Features**
|
25 |
|
26 |
* Code editor with syntax highlighting
|
27 |
* A table showing all PHP core settings and their values
|
28 |
+
* A Search box to search for PHP directives
|
29 |
* Settings that are locally overridden become highlighted in the table
|
30 |
+
* Click on any setting field in the table to copy it to the editor
|
31 |
* Save the settings to local `.ini` files asynchronously (no page reload)
|
32 |
* Delete local `.ini` files created by the plugin
|
33 |
* Refresh the PHP settings table asynchronously (no page reload)
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 1.0.4 =
|
75 |
+
* (NEW) Added checkboxes to allow bulk copy of directives to editor
|
76 |
+
* (NEW) Added a search box to search for PHP directives (based on the great list.js script)
|
77 |
+
* (IMPROVE) Improved security in AJAX calls
|
78 |
+
|
79 |
= 1.0.3 =
|
80 |
* (NEW) Added a link to the PHP settings page in the plugins page
|
81 |
* (FIX) Locally overridden directives are now copied properly to the editor
|
view/options-page.phtml
CHANGED
@@ -2,7 +2,13 @@
|
|
2 |
|
3 |
<div class="plugin-banner">
|
4 |
<img height="128" src="<?php echo PHP_SETTINGS_IMG_URL ?>icon-256x256.png" />
|
5 |
-
<h1>PHP Settings <span>V <?php echo PHP_SETTINGS_VERSION ?></span><br
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
</div>
|
7 |
|
8 |
|
@@ -51,9 +57,17 @@
|
|
51 |
|
52 |
<div id="tab2" class="tab">
|
53 |
<div class="tab-wrapper">
|
54 |
-
<div class="tab-content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
<div id="phpinfo-wrapper">
|
56 |
-
<?php PHPInfo::render('Core') ?>
|
57 |
</div>
|
58 |
<div class="controls">
|
59 |
<button type="submit" name="submit" id="refresh-table" class="button button-primary process-button" data-icon="update" data-processing-text="Refreshing..." data-done-text="Done!">
|
2 |
|
3 |
<div class="plugin-banner">
|
4 |
<img height="128" src="<?php echo PHP_SETTINGS_IMG_URL ?>icon-256x256.png" />
|
5 |
+
<h1>PHP Settings <span>V <?php echo PHP_SETTINGS_VERSION ?></span><br/>
|
6 |
+
<span>Easily edit you INI settings</span><br />
|
7 |
+
<span class="social-buttons"><?php $this->render_social_buttons(); ?></span>
|
8 |
+
</h1>
|
9 |
+
<div id="social-buttons">
|
10 |
+
|
11 |
+
</div>
|
12 |
</div>
|
13 |
|
14 |
|
57 |
|
58 |
<div id="tab2" class="tab">
|
59 |
<div class="tab-wrapper">
|
60 |
+
<div class="tab-content" id="directives">
|
61 |
+
<div id="search-wrapper">
|
62 |
+
<input class="search" placeholder="Search for directives" />
|
63 |
+
<i class="dashicons dashicons-dismiss"></i>
|
64 |
+
</div>
|
65 |
+
<button class="button button-primary" id="copy-directives">
|
66 |
+
<i class="dashicons dashicons-admin-page"></i> <span>Copy To Editor</span>
|
67 |
+
</button>
|
68 |
+
<p id="directive-counter">0 directive selected</p>
|
69 |
<div id="phpinfo-wrapper">
|
70 |
+
<?php echo PHPInfo::render('Core') ?>
|
71 |
</div>
|
72 |
<div class="controls">
|
73 |
<button type="submit" name="submit" id="refresh-table" class="button button-primary process-button" data-icon="update" data-processing-text="Refreshing..." data-done-text="Done!">
|
view/phpinfo.phtml
CHANGED
@@ -1,20 +1,14 @@
|
|
1 |
-
<
|
2 |
-
|
3 |
-
<?php
|
4 |
-
<?php
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
<td><span class="value"><?php echo $val ?></span><span class="button button-primary">Copy to Editor</span></td>
|
16 |
-
</tr>
|
17 |
-
<?php endif ?>
|
18 |
-
<?php endforeach ?>
|
19 |
-
</tbody>
|
20 |
-
</table>
|
1 |
+
<ul id="phpinfo" class="list">
|
2 |
+
<?php $i=0;foreach( $phpinfo_section as $key => $val ): ?>
|
3 |
+
<li <?php echo (is_array($val)?'class="local-override"':'')?>>
|
4 |
+
<p class="list-checkbox"><input type="checkbox" value="<?php echo $i ?>"/></p>
|
5 |
+
<p class="list-key"><?php echo $key ?></p>
|
6 |
+
<p class="list-value">
|
7 |
+
<span class="value"><?php echo is_array($val)?$val[0]:$val; ?></span>
|
8 |
+
<?php if(is_array($val)): ?>
|
9 |
+
<span class="highlight">Locally Overridden</span>
|
10 |
+
<?php endif ?>
|
11 |
+
</p>
|
12 |
+
</li>
|
13 |
+
<?php $i++;endforeach; ?>
|
14 |
+
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
view/social.phtml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- Twitter -->
|
2 |
+
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://products.askupasoftware.com/php-settings/" data-text="PHP Settings - Easily edit you local php.ini settings in #wordpress" data-via="AskupaSoftware">Tweet</a>
|
3 |
+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
4 |
+
<!-- Facebook -->
|
5 |
+
<iframe src="https://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fproducts.askupasoftware.com%2Fphp-settings%2F&width=80px&layout=button_count&action=like&show_faces=true&share=false&height=21&appId=234976736516821" width="80px" height="20" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
|
6 |
+
<!-- Google -->
|
7 |
+
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
8 |
+
<div class="g-plusone" data-size="medium" data-href="http://products.askupasoftware.com/php-settings/"></div>
|