PluginProbe
FeedWordPress / 2011.0721
FeedWordPress v2011.0721
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
feedwordpress / inspectpostmeta.class.php

inspectpostmeta.class.php in FeedWordPress 2011.0721, at inspectpostmeta.class.php

72 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Inspect Post Meta
4 * Creates a post widget to help you inspect some meta fields for posts
5 * Version: 2010.1104
6 * Author: Charles Johnson
7 * Author URI: http://projects.radgeek.com
8 */
9
10 class InspectPostMeta {
11 function InspectPostMeta ($in_hook = true) {
12 if (!$in_hook) :
13 add_action('admin_menu', array($this, 'add_meta_box'));
14 else :
15 $this->add_meta_box();
16 endif;
17 }
18
19 function add_meta_box () {
20 add_meta_box(
21 /*id=*/ 'inspect_post_guid_box',
22 /*title=*/ 'Post GUID and Meta Data',
23 /*callback=*/ array($this, 'meta_box'),
24 /*page=*/ 'post',
25 /*context=*/ 'normal',
26 /*priority=*/ 'default'
27 );
28 }
29
30 function meta_box () {
31 global $post;
32 ?>
33 <table>
34 <tbody>
35 <tr>
36 <th style="text-align: left" scope="row">ID:</th>
37 <td><code><?php print esc_html($post->ID); ?></code></td>
38 </tr>
39
40 <tr>
41 <th style="text-align: left" scope="row">GUID:</th>
42 <td><code><?php print esc_html($post->guid); ?></code></td>
43 </tr>
44
45 <tr>
46 <th colspan="2" style="text-align: center"><h4>Custom Fields</h4></th>
47 </tr>
48
49 <?php
50 $custom = get_post_custom($post->ID);
51 if (count($custom) > 0) :
52 foreach ($custom as $key => $values) :
53 $idx = 1;
54 foreach ($values as $value) :
55 print "<tr><th style='text-align: left' scope='row'>".esc_html($key);
56 if ($idx > 1) :
57 print "[$idx]";
58 endif;
59 print ":</th> ";
60 print "<td><pre><code>".esc_html($value)."</code></pre>";
61 print "</td></tr>\n";
62 $idx++;
63 endforeach;
64 endforeach;
65 else :
66 print "<tr><td colspan='2'><p><em>No custom fields for this post.</em></p></td></tr>\n";
67 endif;
68 print "</table>\n";
69 } /* InspectPostMeta::meta_box() */
70 } /* class InspectPostMeta */
71
72