WordPress phpinfo() - Version 3.5.2

Version Description

Download this release

Release Info

Developer christopherross
Plugin Icon 128x128 WordPress phpinfo()
Version 3.5.2
Comparing to
See all releases

Code changes from version 3.5 to 3.5.2

common/cr-common.php ADDED
@@ -0,0 +1,473 @@
1
+ <?php
2
+
3
+ /*
4
+ /--------------------------------------------------------------------\
5
+ | |
6
+ | License: GPL |
7
+ | |
8
+ | Copyright (C) 2010, Christopher Ross |
9
+ | http://www.bad-neighborhood.com |
10
+ | All rights reserved. |
11
+ | |
12
+ | This program is free software; you can redistribute it and/or |
13
+ | modify it under the terms of the GNU General Public License |
14
+ | as published by the Free Software Foundation; either version 2 |
15
+ | of the License, or (at your option) any later version. |
16
+ | |
17
+ | This program is distributed in the hope that it will be useful, |
18
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of |
19
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20
+ | GNU General Public License for more details. |
21
+ | |
22
+ | You should have received a copy of the GNU General Public License |
23
+ | along with this program; if not, write to the |
24
+ | Free Software Foundation, Inc. |
25
+ | 51 Franklin Street, Fifth Floor |
26
+ | Boston, MA 02110-1301, USA |
27
+ | |
28
+ \--------------------------------------------------------------------/
29
+ */
30
+
31
+
32
+ /*
33
+
34
+ version: 0.0.1
35
+
36
+ */
37
+
38
+
39
+
40
+
41
+ global $cr_wordpress_php_info_plugin_admin_level;
42
+ global $cr_wordpress_php_info_plugin_file_name;
43
+ global $cr_wordpress_php_info_plugin_slug_name;
44
+ global $cr_wordpress_php_info_plugin_admin_menu;
45
+
46
+ global $cr_common_wp_head;
47
+
48
+ add_filter( 'plugin_action_links', 'cr_wordpress_php_info_admin_action' , - $cr_wordpress_php_info_plugin_admin_level, 2 );
49
+ add_action('admin_menu', 'cr_wordpress_php_info_admin_menu');
50
+ add_action('admin_head', 'cr_wordpress_php_info_admin_header');
51
+ add_action('admin_head', 'cr_wordpress_php_info_activation');
52
+ add_action('wp_head', 'cr_wordpress_php_info_header_code');
53
+ add_action('wp_footer', 'cr_wordpress_php_info_footer_code');
54
+
55
+
56
+ if (get_option('cr_wordpress_php_info_dashboard_feed') == 'true') {add_action('wp_dashboard_setup', 'cr_wordpress_php_info_add_dashboard_widgets' );}
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+ function cr_wordpress_php_info_admin_action($links, $file) {
65
+
66
+ // constructs the admin plugin menu and adds links to the plugins page
67
+
68
+ global $cr_wordpress_php_info_plugin_docs;
69
+ global $cr_wordpress_php_info_plugin_forum;
70
+ global $cr_wordpress_php_info_plugin_donate;
71
+ global $cr_wordpress_php_info_plugin_file_name;
72
+
73
+
74
+ $this_plugin = $cr_wordpress_php_info_plugin_file_name."/".$cr_wordpress_php_info_plugin_file_name.".php";
75
+
76
+ if ($file == $this_plugin) {
77
+
78
+ if ($cr_wordpress_php_info_plugin_docs) {$links [] = "<a href='".$cr_wordpress_php_info_plugin_docs ."?".get_bloginfo('url')."'>Docs</a>";}
79
+ if ($cr_wordpress_php_info_plugin_forum) {$links [] = "<a href='".$cr_wordpress_php_info_plugin_forum ."?".get_bloginfo('url')."'>Forum</a>";}
80
+ if ($cr_wordpress_php_info_plugin_donate) {$links [] = "<a href='".$cr_wordpress_php_info_plugin_donate ."?".get_bloginfo('url')."'>Donate</a>";}
81
+
82
+ }
83
+ return $links;
84
+
85
+ }
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ function cr_wordpress_php_info_admin_menu() {
96
+
97
+ // adds the plugin menu to WordPress
98
+
99
+ global $cr_wordpress_php_info_plugin_name;
100
+ global $cr_wordpress_php_info_plugin_slug_name;
101
+ global $cr_wordpress_php_info_plugin_admin_level;
102
+ global $cr_wordpress_php_info_plugin_admin_menu;
103
+
104
+
105
+ if (strlen(get_option($cr_wordpress_php_info_plugin_slug_name.'_menu_location'))>0) {$cr_wordpress_php_info_plugin_admin_menu = get_option($cr_wordpress_php_info_plugin_slug_name.'_menu_location');}
106
+ $cr_wordpress_php_info_plugin_function = $cr_wordpress_php_info_plugin_slug_name."_option";
107
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'dashboard') {add_dashboard_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
108
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'posts') {add_posts_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
109
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'media') {add_media_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
110
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'links') {add_links_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
111
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'comments') {add_comments_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
112
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'theme') {add_theme_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
113
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'plugins') {add_plugins_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
114
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'users') {add_users_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
115
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'tools') {add_management_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
116
+ if ($cr_wordpress_php_info_plugin_admin_menu == 'options') {add_options_page ($cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_name, $cr_wordpress_php_info_plugin_admin_level,$cr_wordpress_php_info_plugin_slug_name, $cr_wordpress_php_info_plugin_function);}
117
+
118
+ }
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+ function cr_wordpress_php_info_dashboard_widget_function() {
132
+
133
+ global $cr_wordpress_php_info_plugin_slug_name;
134
+
135
+ echo "<ul>";
136
+ echo cr_wordpress_php_info_fetch_rss($link = "http://feeds.feedburner.com/thisismyurl?format=xml",$max=5,$format='list');
137
+ echo "</ul>";
138
+ }
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ function cr_wordpress_php_info_add_dashboard_widgets() {
147
+ global $cr_wordpress_php_info_plugin_name;
148
+ wp_add_dashboard_widget('cr_wordpress_php_info_dashboard_widget', $cr_wordpress_php_info_plugin_name.' Plugin Updates', 'cr_wordpress_php_info_dashboard_widget_function');
149
+ }
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+ function cr_wordpress_php_info_activation() {
159
+ // test to see if the plugin has alreasy set the settings
160
+ global $cr_wordpress_php_info_plugin_slug_name;
161
+ global $cr_wordpress_php_info_plugin_admin_level;
162
+ global $cr_wordpress_php_info_plugin_admin_menu;
163
+
164
+ $testoptions = get_option($cr_wordpress_php_info_plugin_slug_name.'_menu_location');
165
+ if (strlen($testoptions) == 0 ) {
166
+ // Install plugin
167
+
168
+ update_option($cr_wordpress_php_info_plugin_slug_name.'_promos', 'true');
169
+ update_option($cr_wordpress_php_info_plugin_slug_name.'_credit', 'false');
170
+ update_option($cr_wordpress_php_info_plugin_slug_name.'_dashboard_feed', 'false');
171
+ update_option($cr_wordpress_php_info_plugin_slug_name.'_access', $cr_wordpress_php_info_plugin_admin_level);
172
+ update_option($cr_wordpress_php_info_plugin_slug_name.'_menu_location', $cr_wordpress_php_info_plugin_admin_menu);
173
+
174
+ }
175
+ }
176
+
177
+
178
+
179
+
180
+
181
+
182
+ function cr_wordpress_php_info_footer_code($options='') {
183
+
184
+ // run this check in the footer of the website
185
+
186
+ global $cr_wordpress_php_info_plugin_slug_name;
187
+ global $cr_wordpress_php_info_plugin_name;
188
+
189
+ // add credit link
190
+ if (get_option($cr_wordpress_php_info_plugin_slug_name.'_credit') == 'true') {
191
+ echo "<p><a href='".cr_wordpress_php_info_fetch_rss('http://feeds.feedburner.com/thisismyurl?format=xml',1,'url')."'>$cr_wordpress_php_info_plugin_name by Christopher Ross</a></p>";
192
+ } else {
193
+ echo "<!-- $cr_wordpress_php_info_plugin_name by Christopher Ross - ".cr_wordpress_php_info_fetch_rss('http://feeds.feedburner.com/thisismyurl?format=xml',1,'url')." -->";
194
+ }
195
+ }
196
+
197
+ function cr_wordpress_php_info_header_code($options='') {
198
+
199
+ }
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ function cr_wordpress_php_info_fetch_rss($link = "http://feeds.feedburner.com/thisismyurl?format=xml",$max=10,$format='url') {
211
+
212
+ // RSS feed for plugins
213
+
214
+ $rss = fetch_feed($link);
215
+ $rss_items = $rss->get_items(0, $max);
216
+ if ($maxitems > 0) {
217
+ foreach ( $rss_items as $item ) {
218
+ if ($format == 'url') {$rsslinks .= $item->get_permalink().", ";}
219
+ if ($format == 'list') {$rsslinks .= "<li><a href='".$item->get_permalink()."'>".$item->get_title()."</a></li>";}
220
+ }
221
+ }
222
+
223
+
224
+ if ($format == 'url') {
225
+ $rsslinks = substr($rsslinks, 0, strlen($rsslinks)-2);
226
+ if (substr_count($color,",")>0) {
227
+ $lastcomma = strrpos($rsslinks,",");
228
+ $rsslinks = substr_replace($rsslinks," and",$lastcomma,1);
229
+ }
230
+ }
231
+
232
+ return $rsslinks;
233
+ }
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+ function cr_wordpress_php_info_option_top() {
243
+
244
+
245
+
246
+ // admin page for plugin
247
+
248
+ global $cr_wordpress_php_info_plugin_name;
249
+ global $cr_wordpress_php_info_plugin_url;
250
+ global $cr_wordpress_php_info_plugin_donate;
251
+ global $cr_wordpress_php_info_plugin_forum;
252
+ global $cr_wordpress_php_info_plugin_slug_name;
253
+ global $updatefields;
254
+ global $cr_wordpress_php_info_plugin_admin_thankyou;
255
+
256
+ // admin page top
257
+ echo "<div class='wrap ' id='wrapper'><div id='icon-options-general' class='icon32'><br /></div>";
258
+ echo "<h2>$cr_wordpress_php_info_plugin_name Settings</h2>";
259
+ echo "<form method='post' action='options.php'>";
260
+ wp_nonce_field('update-options');
261
+
262
+ echo "<div id='cr_admin_top'>";
263
+
264
+ if (get_option($cr_wordpress_php_info_plugin_slug_name.'_promos') != 'false') {
265
+ echo "<h3>Please Support $cr_wordpress_php_info_plugin_name</h3>";
266
+ echo "<p><a href='".$cr_wordpress_php_info_plugin_url."'>".$cr_wordpress_php_info_plugin_name."</a> is a free software package developed to help you make the most of WordPress. You can help support development of $cr_wordpress_php_info_plugin_name and other great WordPress plugins by <a href='".$cr_wordpress_php_info_plugin_donate."'>making a donation</a> or supporting our sponsors.</p>";
267
+ }
268
+
269
+ echo "</div>";
270
+
271
+ // admin page main
272
+
273
+ echo "<div id='cr_admin_main'>";
274
+
275
+
276
+
277
+ }
278
+
279
+
280
+
281
+ function cr_wordpress_php_info_option_bottom() {
282
+
283
+ global $cr_wordpress_php_info_plugin_file_name;
284
+ global $cr_wordpress_php_info_plugin_slug_name;
285
+ global $cr_wordpress_php_info_plugin_name;
286
+ global $cr_wordpress_php_info_plugin_admin_credits;
287
+ global $updatefields;
288
+
289
+
290
+
291
+
292
+
293
+ // display readme.txt
294
+ echo "<div class='accordionButton'><strong>Instructions &amp; readme.txt</strong></div>";
295
+ echo "<div class='accordionContent'><p>";
296
+ $readme = ABSPATH ."/wp-content/plugins/".$cr_wordpress_php_info_plugin_file_name."/readme.txt";
297
+ $fh = fopen($readme, 'r');
298
+ $theData = fread($fh, 50000);
299
+ fclose($fh);
300
+ echo "<pre style='width: 780px;'>".wordwrap($theData,80,"<br />")."</pre>";
301
+ echo "</p></div>";
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+ // display general settings
310
+ echo "<div class='accordionButton'><strong>Plugin System Settings</strong></div>";
311
+ echo "<div class='accordionContent'>";
312
+ echo "<table class='form-table'>";
313
+
314
+
315
+ // which menu should the plugin appear under?
316
+ echo cr_wordpress_php_info_admin_build_option("Menu Location", "_menu_location", "Settings menu location within WordPress menu structure.", "select", "dashboard|Dashboard,posts|Posts,media|Media,links|Links,comments|Comments,theme|Theme,plugins|Plugins,users|Users,tools|Tools,options|Options");
317
+
318
+ // security level for plugin
319
+ echo cr_wordpress_php_info_admin_build_option("Access Level", "_access", "Minimum access level for users to access this plugin settings screen.", "select", "1|1,2|2,3|3,4|4,5|5,6|6,7|7,8|8,9|9,10|Admin");
320
+
321
+ // include credit line
322
+ echo cr_wordpress_php_info_admin_build_option("Include Credit", "_credit", "Include a link in the footer of your website as a thank you for this plugin.", "select", "true|Yes,false|No");
323
+
324
+ // include promos
325
+ echo cr_wordpress_php_info_admin_build_option("Include Promotions", "_promos", "Include promotions and links in the admin settings panel.", "select", "true|Yes,false|No");
326
+
327
+ // include dashboard
328
+ echo cr_wordpress_php_info_admin_build_option("Include Dashbaord Feed", "_dashboard_feed", "Include a feed of updates on the dashboard.", "select", "true|Yes,false|No");
329
+
330
+
331
+
332
+
333
+
334
+ echo "</table>";
335
+ echo "</div>";
336
+
337
+
338
+
339
+
340
+
341
+ // show thank you and credits
342
+
343
+ if (strlen($cr_wordpress_php_info_plugin_admin_credits) > 0) {
344
+ echo "<div class='accordionButton'><strong>Plugin Credits</strong></div>";
345
+ echo "<div class='accordionContent'>";
346
+
347
+ echo $cr_wordpress_php_info_plugin_admin_credits;
348
+
349
+ echo "</div>";
350
+ }
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+ // admin page bottom
359
+
360
+ echo "<p class='submit'>";
361
+
362
+ echo "<input type='hidden' name='action' value='update' />";
363
+
364
+ $updatefields = substr($updatefields, 0, strlen($updatefields)-2);
365
+
366
+ echo "<input type='hidden' name='page_options' value='$updatefields' /> ";
367
+ echo "<input type='submit' class='button-primary' value='Save Changes' />";
368
+
369
+ echo "</p>";
370
+ echo "</form>";
371
+
372
+
373
+ echo "</div>"; // close wrap
374
+
375
+
376
+
377
+
378
+ }
379
+
380
+
381
+
382
+
383
+
384
+
385
+ function cr_wordpress_php_info_admin_build_option($title, $slug, $desc, $type, $data) {
386
+ global $updatefields;
387
+ global $cr_wordpress_php_info_plugin_slug_name;
388
+
389
+
390
+ if ($type == "text") {
391
+ $options = "<input name='".$cr_wp_ab_slug_name.$slug."' id='".$cr_wp_ab_slug_name.$slug."' class='regular-text' value='$data'>";
392
+ }
393
+
394
+
395
+
396
+
397
+
398
+ if ($type == "select") {
399
+ $options = "<select name='".$cr_wordpress_php_info_plugin_slug_name.$slug."' id='".$cr_wordpress_php_info_plugin_slug_name.$slug."' class='postform' >";
400
+
401
+ $data = explode(",",$data);
402
+ foreach ($data as $line) {
403
+ $linedata = explode("|",$line);
404
+ $options .= "<option class='level-0' value='".$linedata[0]."' ";
405
+
406
+ $current = get_option($cr_wordpress_php_info_plugin_slug_name.$slug);
407
+
408
+ if ($current == $linedata[0]) {$options .= "selected";}
409
+
410
+ $options .=">".$linedata[1]."</option>";
411
+ }
412
+
413
+ $options .= "</select>";
414
+ }
415
+
416
+ $updatefields .= $cr_wordpress_php_info_plugin_slug_name.$slug.", ";
417
+
418
+
419
+ return "<tr valign='top'>
420
+ <th scope='row'><label for='".$cr_wordpress_php_info_plugin_slug_name.$slug."'>$title</label></th>
421
+ <td>
422
+ $options
423
+ <p>$desc</p>
424
+ </td>
425
+ </tr>";
426
+ }
427
+
428
+
429
+
430
+ function cr_wordpress_php_info_admin_header() {
431
+
432
+ // admin header css & js for the plugin
433
+ global $cr_wordpress_php_info_plugin_slug_name;
434
+ global $cr_wordpress_php_info_plugin_file_name;
435
+ global $cr_common_wp_head;
436
+
437
+
438
+ if ($cr_common_wp_head != true) {
439
+ $cr_common_wp_head = true;
440
+
441
+
442
+ $url = get_option('siteurl');
443
+ $cssurl = $url . "/wp-content/plugins/".$cr_wordpress_php_info_plugin_file_name."/common/wp-admin.css";
444
+ $jsurl = $url . "/wp-content/plugins/".$cr_wordpress_php_info_plugin_file_name."/common/wp-admin.js";
445
+
446
+ echo "<link rel='stylesheet' type='text/css' href='". $cssurl ."' />";
447
+
448
+ // google ads
449
+ echo " <script type='text/javascript' src='http://partner.googleadservices.com/gampad/google_service.js'></script>
450
+ <script type='text/javascript'>GS_googleAddAdSenseService('ca-pub-9144171931162286'); GS_googleEnableAllServices();</script>
451
+ <script type='text/javascript'>GA_googleAddSlot('ca-pub-9144171931162286', '300x250');</script>
452
+ <script type='text/javascript'>GA_googleFetchAds();</script>";
453
+
454
+ // add menus
455
+ echo " <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
456
+ <script type='text/javascript' src='".$jsurl."'></script>
457
+ ";
458
+ }
459
+ }
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+
468
+ function cr_wordpress_php_info_update() {
469
+
470
+ }
471
+
472
+
473
+ ?>
common/index.php ADDED
@@ -0,0 +1,5 @@
1
+ <?php
2
+
3
+ // silence.
4
+
5
+ ?>
common/wp-admin-heading.png ADDED
Binary file
common/wp-admin.css ADDED
@@ -0,0 +1,49 @@
1
+ #cr_admin_bottom ul {
2
+ list-style: square;
3
+ margin-left: 20px;
4
+ }
5
+
6
+ #cr_admin_bottom_right {
7
+ float: right;
8
+ margin-left: 20px;
9
+ }
10
+
11
+
12
+
13
+
14
+ #wrapper {
15
+ width: 800px;
16
+ margin-left: auto;
17
+ margin-right: auto;
18
+ }
19
+
20
+ .accordionButton {
21
+ width: 800px;
22
+ height: 20px;
23
+ float: left;
24
+ cursor: pointer;
25
+ margin-bottom: 10px;
26
+
27
+ background: url('wp-admin-heading.png') no-repeat;
28
+ color: #FFFFFF;
29
+ font-size: 10px;
30
+ padding-left: 10px;
31
+ padding-top: 1px;
32
+ }
33
+
34
+ .accordionContent {
35
+ float: left;
36
+ background: #efefef;
37
+ margin-bottom: 10px;
38
+ padding: 0px 10px;
39
+ display: none;
40
+ border: solid 1px #cccccc;
41
+
42
+ -moz-border-radius: 5px;
43
+ border-radius: 5px;
44
+ clear: both;
45
+ overflow: hidden;
46
+ width: 780px;
47
+ }
48
+
49
+
common/wp-admin.js ADDED
@@ -0,0 +1,12 @@
1
+ $(document).ready(function() {
2
+
3
+ //ACCORDION BUTTON ACTION
4
+ $('div.accordionButton').click(function() {
5
+ $('div.accordionContent').slideUp('normal');
6
+ $(this).next().slideDown('normal');
7
+ });
8
+
9
+ //HIDE THE DIVS ON PAGE LOAD
10
+ $('div.accordionContent').hide();
11
+
12
+ });
icon.png DELETED
Binary file
readme.txt CHANGED
@@ -1,23 +1,26 @@
1
=== Plugin Name ===
2
Contributors: christopherross
3
- Plugin URI: http://thisismyurl.com/downloads/wordpress/plugins/wordpress-phpinfo/
4
Donate link: http://thisismyurl.com/
5
Tags: simple, php, admin, phpinfo,debugging, configuration, server, support, troubleshooting
6
Requires at least: 3.0.0
7
- Tested up to: 3.2.1
8
- Stable tag: 3.5
9
10
It's important for a non technical administrator to be able to diagnose server related problems in WordPress.
11
12
== Description ==
13
14
- It's important for a non technical administrator to be able to diagnose server related problems in WordPress but also rapidly retrieve feedback regarding their web server. This simple plugin adds an option to an administrator's Tools menu which displays standard phpinfo() feedback details to the user.
15
16
This a very simple script, designed to help the non technical user get immediate feedback about their blog.
17
18
== Updates ==
19
20
- Updates to the plugin will be posted here, to [Christopher Ross](http://thisismyurl.com/downloads/wordpress/plugins/wordpress-phpinfo/)
21
22
== Screenshots ==
23
@@ -41,7 +44,7 @@ To call the function from a theme include the code wordpressphpinfo(); in your t
41
42
== Donations ==
43
44
- If you would like to donate to help support future development of this tool, please visit [Christopher Ross](http://thisismyurl.com/downloads/wordpress/plugins/wordpress-phpinfo/)
45
46
47
== Change Log ==
@@ -95,4 +98,4 @@ Added the change log
95
96
3.0.01
97
* converted plugin to utilize CR common library
98
- * altered phpinfo() output to avoid theme conflicts
1
=== Plugin Name ===
2
Contributors: christopherross
3
+ Plugin URI: http://thisismyurl.com/plugins/wordpress-phpinfo/
4
Donate link: http://thisismyurl.com/
5
Tags: simple, php, admin, phpinfo,debugging, configuration, server, support, troubleshooting
6
Requires at least: 3.0.0
7
+ Tested up to: 3.5.1
8
+ Stable tag: 3.5.2
9
10
It's important for a non technical administrator to be able to diagnose server related problems in WordPress.
11
12
== Description ==
13
14
+ It's important for a non technical administrator to be able to diagnose server related problems in WordPress but also rapidly retrieve feedback regarding their web server. This simple plugin adds an option to an administrator's Tools menu which displays standard phpinfo() feedback details to the user.
15
16
This a very simple script, designed to help the non technical user get immediate feedback about their blog.
17
18
+ This plugin is maintained by Christopher Ross, http://thisismyurl.com or you can find him on Twitter at http://twitter.com/thisismyurl/
19
+
20
+
21
== Updates ==
22
23
+ Updates to the plugin will be posted here, to [Christopher Ross](http://thisismyurl.com/plugins/wordpress-phpinfo/)
24
25
== Screenshots ==
26
44
45
== Donations ==
46
47
+ If you would like to donate to help support future development of this tool, please visit [Christopher Ross](http://thisismyurl.com/plugins/wordpress-phpinfo/)
48
49
50
== Change Log ==
98
99
3.0.01
100
* converted plugin to utilize CR common library
101
+ * altered phpinfo() output to avoid theme conflicts
screenshot-1.jpg DELETED
Binary file
timu-phpinfo.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
- /*
3
- legacy file, no longer used.
4
- */
5
-
6
- include_once('wordpress-php-info.php')
7
-
8
- ?>
wordpress-php-info.php CHANGED
@@ -1,153 +1,139 @@
1
<?php
2
/*
3
Plugin Name: WordPress phpinfo()
4
- Plugin URI: http://thisismyurl.com/downloads/wordpress/plugins/wordpress-phpinfo/
5
- Description: This simple plugin adds an option to an adminstrator's Tools menu which displays standard phpinfo() feedback details to the user.
6
Author: Christopher Ross
7
- Version: 3.5.0
8
- Author URI: http://thisismyurl.com
9
*/
10
11
12
- /*
13
- /--------------------------------------------------------------------\
14
- | |
15
- | License: GPL |
16
- | |
17
- | Copyright (C) 2011, Christopher Ross |
18
- | http://thisismyurl.com |
19
- | All rights reserved. |
20
- | |
21
- | This program is free software; you can redistribute it and/or |
22
- | modify it under the terms of the GNU General Public License |
23
- | as published by the Free Software Foundation; either version 2 |
24
- | of the License, or (at your option) any later version. |
25
- | |
26
- | This program is distributed in the hope that it will be useful, |
27
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
28
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
29
- | GNU General Public License for more details. |
30
- | |
31
- | You should have received a copy of the GNU General Public License |
32
- | along with this program; if not, write to the |
33
- | Free Software Foundation, Inc. |
34
- | 51 Franklin Street, Fifth Floor |
35
- | Boston, MA 02110-1301, USA |
36
- | |
37
- \--------------------------------------------------------------------/
38
- */
39
40
41
// add menu to WP admin
42
function thisismyurl_php_info_wordpress_menu() {
43
- $thisismyurl_php_info_settings = add_management_page( 'phpinfo()', 'phpinfo()', 'edit_posts', 'thisismyurl_php_info', 'thisismyurl_php_info_wordpress_options');
44
- add_action('load-'.$thisismyurl_php_info_settings, 'thisismyurl_php_info_wordpress_scripts');
45
}
46
- add_action('admin_menu', 'thisismyurl_php_info_wordpress_menu');
47
48
49
function thisismyurl_php_info_wordpress_scripts() {
50
- wp_enqueue_style('dashboard');
51
- wp_enqueue_script('postbox');
52
- wp_enqueue_script('dashboard');
53
?>
54
-
55
-
56
-
57
- <style>
58
.thisismyurl_php_info_key {width: 30%; float: left; padding-bottom: 10px; clear:left;}
59
.thisismyurl_php_info_value {width: 70%; float: left; padding-bottom: 10px; clear:right;}
60
</style>
61
-
62
-
63
-
64
-
65
- <?php
66
67
}
68
69
function thisismyurl_php_info_wordpress_options() {
70
-
71
- if ($_POST) {
72
- $setting = array($_POST['setting1'],$_POST['setting2'],$_POST['setting3']);
73
- update_option('thisismyurl_php_info', json_encode($setting));
74
- }
75
-
76
- if (empty($setting)) {
77
- $setting = json_decode(get_option('thisismyurl_php_info'));
78
}
79
-
80
$settingcount = 0;
81
- foreach ($setting as $settingitem) {
82
- if ($setting[$settingcount]) {$cb[$settingcount] = 'checked="checked"';}
83
- $settingcount++;
84
}
85
86
-
87
echo '<div class="wrap">
88
<div class="thisismyurl icon32"><br /></div>
89
- <h2>'.__('Settings for External Links to New Window','thisismyurl_php_info').'</h2>
90
<div class="postbox-container" style="width:70%">
91
<div class="metabox-holder">
92
<div class="meta-box-sortables">';
93
- $php_info = (thisismyurl_php_info_phpinfo_array() );
94
- foreach ($php_info as $php_info_section_key => $php_info_section) {
95
-
96
- echo '
97
-
98
-
99
- <div id="edit-pages" class="postbox">
100
- <div class="handlediv" title="'.__('Click to toggle','thisismyurl_php_info').'"><br /></div>
101
- <h3 class="hndle"><span>'.__($php_info_section_key,'thisismyurl_php_info').'</span></h3>
102
- <div class="inside">';
103
- foreach ($php_info_section as $key => $value) {
104
- echo "<div class='thisismyurl_php_info_key'>".$key."</div>";
105
- echo "<div class='thisismyurl_php_info_value'>".wordwrap($value, 50, "<br />\n",true)."</div>";
106
- }
107
-
108
- echo' <div style="clear:both;"></div>
109
- </div><!-- .inside -->
110
- </div><!-- #edit-pages -->
111
-
112
-
113
-
114
- ';
115
}
116
echo ' </div><!-- .meta-box-sortables -->
117
- </div><!-- .metabox-holder -->
118
-
119
</div><!-- .postbox-container -->
120
-
121
<div class="postbox-container" style="width:20%">
122
-
123
<div class="metabox-holder">
124
<div class="meta-box-sortables">
125
-
126
<div id="edit-pages" class="postbox">
127
- <div class="handlediv" title="'.__('Click to toggle','thisismyurl_php_info').'"><br /></div>
128
- <h3 class="hndle"><span>'.__('Plugin Information','thisismyurl_php_info').'</span></h3>
129
<div class="inside">
130
- <p>'.__('phpinfo() by Christopher Ross is a free WordPress plugin. If you\'ve enjoyed the plugin please give the plugin 5 stars on WordPress.org.','thisismyurl_php_info').'</p>
131
- <p>'.__('Want to help? Please consider translating this pluginto your local language, or offering a hand in the support forums.','thisismyurl_php_info').'</p>
132
- <p><a href="http://wordpress.org/extend/plugins/wordpress-php-info/">WordPress.org</a> | <a href="http://thisismyurl.com">'.__('Plugin Author','thisismyurl_php_info').'</a></p>
133
</div><!-- .inside -->
134
</div><!-- #edit-pages -->
135
-
136
</div><!-- .meta-box-sortables -->
137
</div><!-- .metabox-holder -->
138
-
139
- </div><!-- .postbox-container -->
140
</div><!-- .wrap -->
141
-
142
';
143
}
144
145
146
- function thisismyurl_php_info_phpinfo_array($return=false){
147
- /* Andale! Andale! Yee-Hah! */
148
- ob_start();
149
phpinfo(-1);
150
-
151
$pi = preg_replace(
152
array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms',
153
'#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
@@ -163,19 +149,18 @@ function thisismyurl_php_info_phpinfo_array($return=false){
163
'<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
164
'<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" .
165
'<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'),
166
- ob_get_clean());
167
-
168
- $sections = explode('<h2>', strip_tags($pi, '<h2><th><td>'));
169
- unset($sections[0]);
170
-
171
$pi = array();
172
- foreach($sections as $section){
173
- $n = substr($section, 0, strpos($section, '</h2>'));
174
- preg_match_all('#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#',$section, $askapache, PREG_SET_ORDER);
175
- foreach($askapache as $m)
176
- $pi[$n][$m[1]]=(!isset($m[3])||$m[2]==$m[3])?$m[2]:array_slice($m,2);
177
}
178
-
179
return $pi;
180
}
181
- ?>
1
<?php
2
/*
3
Plugin Name: WordPress phpinfo()
4
+ Plugin URI: http://thisismyurl.com/plugins/wordpress-phpinfo/
5
+ Description: This simple plugin adds an option to an adminstrator's Tools menu which displays standard phpinfo() feedback details to the user.
6
Author: Christopher Ross
7
+ Version: 3.5.2
8
+ Author URI: http://thisismyurl.com/
9
*/
10
11
12
+ /**
13
+ * WordPress phpinfo() core file
14
+ *
15
+ * This file contains all the logic required for the plugin
16
+ *
17
+ * @link http://wordpress.org/extend/plugins/wordpress-phpinfo/
18
+ *
19
+ * @package WordPress phpinfo()
20
+ * @copyright Copyright (c) 2008, Chrsitopher Ross
21
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License, v2 (or newer)
22
+ *
23
+ * @since WordPress phpinfo() 1.0
24
+ */
25
26
27
// add menu to WP admin
28
function thisismyurl_php_info_wordpress_menu() {
29
+ $thisismyurl_php_info_settings = add_management_page( 'phpinfo()', 'phpinfo()', 'edit_posts', 'thisismyurl_php_info', 'thisismyurl_php_info_wordpress_options' );
30
+ add_action( 'load-'.$thisismyurl_php_info_settings, 'thisismyurl_php_info_wordpress_scripts' );
31
}
32
+ add_action( 'admin_menu', 'thisismyurl_php_info_wordpress_menu' );
33
34
35
function thisismyurl_php_info_wordpress_scripts() {
36
+ wp_enqueue_style( 'dashboard' );
37
+ wp_enqueue_script( 'postbox' );
38
+ wp_enqueue_script( 'dashboard' );
39
?>
40
+ <style>
41
.thisismyurl_php_info_key {width: 30%; float: left; padding-bottom: 10px; clear:left;}
42
.thisismyurl_php_info_value {width: 70%; float: left; padding-bottom: 10px; clear:right;}
43
</style>
44
+ <?php
45
46
}
47
48
function thisismyurl_php_info_wordpress_options() {
49
+
50
+ if ( $_POST ) {
51
+ $setting = array( $_POST['setting1'], $_POST['setting2'], $_POST['setting3'] );
52
+ update_option( 'thisismyurl_php_info', json_encode( $setting ) );
53
}
54
+
55
+ if ( empty( $setting ) )
56
+ $setting = json_decode( get_option( 'thisismyurl_php_info' ) );
57
+
58
+
59
$settingcount = 0;
60
+ if ( $setting ) {
61
+ foreach ( $setting as $settingitem ) {
62
+
63
+ if ( $setting[$settingcount] )
64
+ $cb[$settingcount] = 'checked="checked"';
65
+
66
+ $settingcount++;
67
+ }
68
}
69
70
+
71
echo '<div class="wrap">
72
<div class="thisismyurl icon32"><br /></div>
73
+ <h2>'.__( 'PHPinfo() for WordPress by Christopher Ross','thisismyurl_php_info' ).'</h2>
74
<div class="postbox-container" style="width:70%">
75
<div class="metabox-holder">
76
<div class="meta-box-sortables">';
77
+ $php_info = ( thisismyurl_php_info_phpinfo_array() );
78
+
79
+ if ( $php_info ) {
80
+ foreach ( $php_info as $php_info_section_key => $php_info_section ) {
81
+
82
+ echo '
83
+ <div id="edit-pages" class="postbox">
84
+ <div class="handlediv" title="' . __( 'Click to toggle','thisismyurl_php_info' ) . '"><br /></div>
85
+ <h3 class="hndle"><span>' . __( $php_info_section_key,'thisismyurl_php_info' ) . '</span></h3>
86
+ <div class="inside">';
87
+
88
+ if ( $php_info_section ) {
89
+ foreach ( $php_info_section as $key => $value ) {
90
+
91
+ if ( !is_string( $value ) )
92
+ $value = strval( $value );
93
+
94
+ echo "<div class='thisismyurl_php_info_key'>" . $key . "</div>";
95
+ echo "<div class='thisismyurl_php_info_value'>" . wordwrap( $value, 50, "<br />\n", true ) . "</div>";
96
+ }
97
+ }
98
+
99
+ echo'<div style="clear:both;"></div></div><!-- .inside --></div><!-- #edit-pages -->';
100
+ }
101
}
102
+
103
echo ' </div><!-- .meta-box-sortables -->
104
+ </div><!-- .metabox-holder -->
105
+
106
</div><!-- .postbox-container -->
107
+
108
<div class="postbox-container" style="width:20%">
109
+
110
<div class="metabox-holder">
111
<div class="meta-box-sortables">
112
+
113
<div id="edit-pages" class="postbox">
114
+ <div class="handlediv" title="'.__( 'Click to toggle','thisismyurl_php_info' ).'"><br /></div>
115
+ <h3 class="hndle"><span>'.__( 'Plugin Information','thisismyurl_php_info' ).'</span></h3>
116
<div class="inside">
117
+ <p>'.__( 'phpinfo() by Christopher Ross is a free WordPress plugin. If you\'ve enjoyed the plugin please give the plugin 5 stars on WordPress.org.','thisismyurl_php_info' ).'</p>
118
+ <p>'.__( 'Want to help? Please consider translating this pluginto your local language, or offering a hand in the support forums.','thisismyurl_php_info' ).'</p>
119
+ <p><a href="http://wordpress.org/extend/plugins/wordpress-php-info/">WordPress.org</a> | <a href="http://thisismyurl.com">'.__( 'Plugin Author','thisismyurl_php_info' ).'</a></p>
120
</div><!-- .inside -->
121
</div><!-- #edit-pages -->
122
+
123
</div><!-- .meta-box-sortables -->
124
</div><!-- .metabox-holder -->
125
+
126
+ </div><!-- .postbox-container -->
127
</div><!-- .wrap -->
128
+
129
';
130
}
131
132
+ function thisismyurl_php_info_phpinfo_array( $return=false ){
133
134
+ ob_start();
135
phpinfo(-1);
136
+
137
$pi = preg_replace(
138
array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms',
139
'#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
149
'<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
150
'<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" .
151
'<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'),
152
+ ob_get_clean() );
153
+
154
+ $sections = explode( '<h2>', strip_tags( $pi, '<h2><th><td>' ) );
155
+ unset( $sections[0] );
156
+
157
$pi = array();
158
+ foreach( $sections as $section ) {
159
+ $n = substr( $section, 0, strpos( $section, '</h2>' ) );
160
+ preg_match_all( '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#',$section, $askapache, PREG_SET_ORDER );
161
+ foreach( $askapache as $m )
162
+ $pi[$n][$m[1]]=( !isset( $m[3] )||$m[2]==$m[3] )?$m[2]:array_slice( $m,2 );
163
}
164
+
165
return $pi;
166
}