PluginProbe
FeedWordPress / 2009.1112
FeedWordPress v2009.1112
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 / backend-page.php

backend-page.php in FeedWordPress 2009.1112, at backend-page.php

143 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require_once(dirname(__FILE__) . '/admin-ui.php');
3
4 class FeedWordPressBackendPage extends FeedWordPressAdminPage {
5 function FeedWordPressBackendPage () {
6 // Set meta-box context name
7 FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressbackendpage');
8 $this->dispatch = 'feedwordpress_backend';
9 $this->filename = __FILE__;
10 }
11
12 function has_link () { return false; }
13
14 function display () {
15 global $wpdb, $wp_db_version, $fwp_path;
16 global $fwp_post;
17
18 if (FeedWordPress::needs_upgrade()) :
19 fwp_upgrade_page();
20 return;
21 endif;
22
23 // If this is a POST, validate source and user credentials
24 FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_backend', /*capability=*/ 'manage_options');
25
26 if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') :
27 $this->accept_POST($fwp_post);
28 do_action('feedwordpress_admin_page_backend_save', $GLOBALS['fwp_post'], $this);
29 endif;
30
31 ////////////////////////////////////////////////
32 // Prepare settings page ///////////////////////
33 ////////////////////////////////////////////////
34
35 $this->display_update_notice_if_updated('Back End');
36
37 $this->open_sheet('FeedWordPress Back End');
38 ?>
39 <div id="post-body">
40 <?php
41 $boxes_by_methods = array(
42 'performance_box' => __('Performance'),
43 'diagnostics_box' => __('Diagnostics'),
44 );
45
46 foreach ($boxes_by_methods as $method => $title) :
47 fwp_add_meta_box(
48 /*id=*/ 'feedwordpress_'.$method,
49 /*title=*/ $title,
50 /*callback=*/ array('FeedWordPressBackendPage', $method),
51 /*page=*/ $this->meta_box_context(),
52 /*context=*/ $this->meta_box_context()
53 );
54 endforeach;
55 do_action('feedwordpress_admin_page_backend_meta_boxes', $this);
56 ?>
57 <div class="metabox-holder">
58 <?php
59 fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this);
60 ?>
61 </div> <!-- class="metabox-holder" -->
62 </div> <!-- id="post-body" -->
63
64 <?php
65 $this->close_sheet();
66 } /* FeedWordPressBackendPage::display () */
67
68 function accept_POST ($post) {
69 if (isset($post['submit'])
70 or isset($post['save'])
71 or isset($post['create_index'])
72 or isset($post['clear_cache'])) :
73 update_option('feedwordpress_update_logging', $post['update_logging']);
74 update_option('feedwordpress_debug', $post['feedwordpress_debug']);
75 $this->updated = true; // Default update message
76 endif;
77
78 if (isset($post['create_index'])) :
79 FeedWordPress::create_guid_index();
80 $this->updated = __('Index created on database table.');
81 endif;
82
83 if (isset($_POST['clear_cache'])) :
84 FeedWordPress::clear_cache();
85 $this->updated = __("Cleared all cached feeds from WordPress database.");
86 endif;
87 } /* FeedWordPressBackendPage::accept_POST () */
88
89 /*static*/ function performance_box ($page, $box = NULL) {
90 // Hey ho, let's go...
91 ?>
92 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
93 <tr style="vertical-align: top">
94 <th width="33%" scope="row">Feed cache:</th>
95 <td width="67%"><input class="button" type="submit" name="clear_cache" value="Clear all cached feeds from WordPress database" />
96 <p>This will clear all cached copies of feed data from the WordPress database
97 and force FeedWordPress to make a fresh scan for updates on syndicated feeds.</p></td></tr>
98
99 <tr style="vertical-align: top">
100 <th width="33%" scope="row">Guid index:</th>
101 <td width="67%"><input class="button" type="submit" name="create_index" value="Create index on guid column in posts database table" />
102 <p>Creating this index may significantly improve performance on some large
103 FeedWordPress installations.</p></td>
104 </tr>
105 </table>
106 <?php
107 } /* FeedWordPressBackendPage::performance_box () */
108
109 /*static*/ function diagnostics_box ($page, $box = NULL) {
110 $settings = array();
111 $settings['update_logging'] = (get_option('feedwordpress_update_logging')=='yes');
112 $settings['debug'] = (get_option('feedwordpress_debug')=='yes');
113
114 // Hey ho, let's go...
115 ?>
116 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
117 <tr style="vertical-align: top">
118 <th width="33%" scope="row">Logging:</th>
119 <td width="67%"><select name="update_logging" size="1">
120 <option value="yes"<?php echo ($settings['update_logging'] ?' selected="selected"':''); ?>>log updates, new posts, and updated posts in PHP logs</option>
121 <option value="no"<?php echo ($settings['update_logging'] ?'':' selected="selected"'); ?>>don't log updates</option>
122 </select></td>
123 </tr>
124 <tr style="vertical-align: top">
125 <th width="33%" scope="row">Debugging mode:</th>
126 <td width="67%"><select name="feedwordpress_debug" size="1">
127 <option value="yes"<?php echo ($settings['debug'] ? ' selected="selected"' : ''); ?>>on</option>
128 <option value="no"<?php echo ($settings['debug'] ? '' : ' selected="selected"'); ?>>off</option>
129 </select>
130 <p>When debugging mode is <strong>ON</strong>, FeedWordPress displays many diagnostic error messages,
131 warnings, and notices that are ordinarily suppressed, and turns off all caching of feeds. Use with
132 caution: this setting is absolutely inappropriate for a production server.</p>
133 </td>
134 </tr>
135 </table>
136 <?php
137 } /* FeedWordPressBackendPage::performance_box () */
138 } /* class FeedWordPressBackendPage */
139
140 $backendPage = new FeedWordPressBackendPage;
141 $backendPage->display();
142
143