| @@ -1,29 +1,32 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__) . '/admin-ui.php'); |
| 3 | 3 | |
| 4 | 4 | class FeedWordPressPerformancePage extends FeedWordPressAdminPage { |
| 5 | - public function __construct() { | |
| 5 | + function FeedWordPressPerformancePage () { | |
| 6 | 6 | // Set meta-box context name |
| 7 | - parent::__construct('feedwordpressperformancepage'); | |
| 7 | + FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressperformancepage'); | |
| 8 | 8 | $this->dispatch = 'feedwordpress_performance'; |
| 9 | 9 | $this->filename = __FILE__; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | - public function has_link () { return false; } | |
| 12 | + function has_link () { return false; } | |
| 13 | 13 | |
| 14 | 14 | function display () { |
| 15 | + global $wpdb, $wp_db_version, $fwp_path; | |
| 16 | + global $fwp_post; | |
| 17 | + | |
| 15 | 18 | if (FeedWordPress::needs_upgrade()) : |
| 16 | 19 | fwp_upgrade_page(); |
| 17 | 20 | return; |
| 18 | 21 | endif; |
| 19 | - | |
| 22 | + | |
| 20 | 23 | // If this is a POST, validate source and user credentials |
| 21 | 24 | FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_performance', /*capability=*/ 'manage_options'); |
| 22 | - | |
| 25 | + | |
| 23 | 26 | if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') : |
| 24 | - $this->accept_POST(); | |
| 25 | - do_action('feedwordpress_admin_page_performance_save', null, $this); | |
| 27 | + $this->accept_POST($fwp_post); | |
| 28 | + do_action('feedwordpress_admin_page_performance_save', $GLOBALS['fwp_post'], $this); | |
| 26 | 29 | endif; |
| 27 | 30 | |
| 28 | 31 | //////////////////////////////////////////////// |
| 29 | 32 | // Prepare settings page /////////////////////// |
| @@ -37,9 +40,9 @@ | ||
| 37 | 40 | <?php |
| 38 | 41 | $boxes_by_methods = array( |
| 39 | 42 | 'performance_box' => __('Performance'), |
| 40 | 43 | ); |
| 41 | - | |
| 44 | + | |
| 42 | 45 | foreach ($boxes_by_methods as $method => $title) : |
| 43 | 46 | add_meta_box( |
| 44 | 47 | /*id=*/ 'feedwordpress_'.$method, |
| 45 | 48 | /*title=*/ $title, |
| @@ -51,9 +54,9 @@ | ||
| 51 | 54 | do_action('feedwordpress_admin_page_performance_meta_boxes', $this); |
| 52 | 55 | ?> |
| 53 | 56 | <div class="metabox-holder"> |
| 54 | 57 | <?php |
| 55 | - do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this); | |
| 58 | + fwp_do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this); | |
| 56 | 59 | ?> |
| 57 | 60 | </div> <!-- class="metabox-holder" --> |
| 58 | 61 | </div> <!-- id="post-body" --> |
| 59 | 62 | |
| @@ -60,30 +63,26 @@ | ||
| 60 | 63 | <?php |
| 61 | 64 | $this->close_sheet(); |
| 62 | 65 | } /* FeedWordPressPerformancePage::display () */ |
| 63 | 66 | |
| 64 | - function accept_POST () { | |
| 65 | - global $feedwordpress; | |
| 66 | - | |
| 67 | - if ( ! is_null( FeedWordPress::post( 'create_index' ) ) ) : | |
| 67 | + function accept_POST ($post) { | |
| 68 | + if (isset($post['create_index'])) : | |
| 68 | 69 | FeedWordPress::create_guid_index(); |
| 69 | 70 | $this->updated = __('guid column index created on database table.'); |
| 70 | 71 | endif; |
| 71 | - if ( ! is_null( FeedWordPress::post( 'remove_index' ) ) ) : | |
| 72 | + if (isset($post['remove_index'])) : | |
| 72 | 73 | FeedWordPress::remove_guid_index(); |
| 73 | 74 | $this->updated = __('guid column index removed from database table.'); |
| 74 | 75 | endif; |
| 75 | 76 | |
| 76 | - if ( ! is_null( FeedWordPress::post( 'clear_cache' ) ) ) : | |
| 77 | - $N = $feedwordpress->clear_cache(); | |
| 77 | + if (isset($post['clear_cache'])) : | |
| 78 | + $N = FeedWordPress::clear_cache(); | |
| 78 | 79 | $feeds = (($N == 1) ? __("feed") : __("feeds")); |
| 79 | - $this->updated = sprintf( __("Cleared %d cached %s from WordPress database."), $N, $feeds ); | |
| 80 | + $this->updated = sprintf(__("Cleared %d cached %s from WordPress database."), $N, $feeds); | |
| 80 | 81 | endif; |
| 81 | - | |
| 82 | 82 | } /* FeedWordPressPerformancePage::accept_POST () */ |
| 83 | 83 | |
| 84 | - static function performance_box ($page, $box = NULL) { | |
| 85 | - | |
| 84 | + /*static*/ function performance_box ($page, $box = NULL) { | |
| 86 | 85 | // Hey ho, let's go... |
| 87 | 86 | ?> |
| 88 | 87 | <table class="editform" width="100%" cellspacing="2" cellpadding="5"> |
| 89 | 88 | <tr style="vertical-align: top"> |
| @@ -93,9 +92,9 @@ | ||
| 93 | 92 | and force FeedWordPress to make a fresh scan for updates on syndicated feeds.</p></td></tr> |
| 94 | 93 | |
| 95 | 94 | <tr style="vertical-align: top"> |
| 96 | 95 | <th width="33%" scope="row">Guid index:</th> |
| 97 | -<td width="67%"><?php if ( !FeedWordPress::has_guid_index()) : ?> | |
| 96 | +<td width="67%"><?php if (!FeedWordPress::has_guid_index()) : ?> | |
| 98 | 97 | <input class="button" type="submit" name="create_index" value="Create index on guid column in posts database table" /> |
| 99 | 98 | <p>Creating this index may significantly improve performance on some large |
| 100 | 99 | FeedWordPress installations.</p> |
| 101 | 100 | <?php else : ?> |
| @@ -106,9 +105,8 @@ | ||
| 106 | 105 | <input class="button" type="submit" name="remove_index" value="Remove index on guid column in posts database table" /> |
| 107 | 106 | |
| 108 | 107 | <?php endif; ?> |
| 109 | 108 | |
| 110 | -</tr> | |
| 111 | 109 | |
| 112 | 110 | </td> |
| 113 | 111 | </tr> |
| 114 | 112 | </table> |