/** * Add Admin Bar Alerts * * @param WP_Admin_Bar $wp_admin_bar Reference to the admin bar instance. */ private function add_admin_bar_alerts($wp_admin_bar) { $changed = $this->checker->get_changed_data(); foreach ($changed as $test => $value) { $args = array('id' => 'site_move_monitor_alert_' . sanitize_key($test), 'title' => sprintf(__('%s Changed', 'site-move-monitor'), $value), 'parent' => 'site_move_monitor_alerts', 'href' => admin_url('tools.php?page=site_move_monitor')); $wp_admin_bar->add_node($args); } }
/** * Uninstall * * @access private */ public function uninstall() { // Exit if uninstall not called from WordPress. if (!defined('WP_UNINSTALL_PLUGIN')) { exit; } $checker = new Site_Move_Monitor_Checker(); $checker->reset_stored_data(); }
/** * Admin Options Page * * @access private */ public function options_page() { $tests = $this->checker->get_tests(); $current = $this->checker->get_current_data(); $stored = $this->checker->get_stored_data(); ?> <div class="wrap"> <h2><?php esc_html_e('Site Move Monitor', 'site-move-monitor'); ?> </h2> <p><?php esc_html_e('Site Move Monitor checks your site hosting and configuration and monitors for changes in the setup that may indicate that your site has moved. This can help alert you to a change in environment. For example moving a site from a staging to a production environment.', 'site-move-monitor'); ?> </p> <h2><?php esc_html_e('Current Configuration', 'site-move-monitor'); ?> </h2> <form method="POST" class="site-move-monitor-current-configuration"> <table> <?php foreach ($current as $test => $value) { ?> <tr> <th style="text-align: left; padding-right: 20px;"><?php echo $tests[$test]; ?> </th> <td> <?php if (empty($stored[$test]) || $stored[$test] == $value) { echo $value; } else { printf('<del style="color: #c00;">%s</del> → %s', $stored[$test], $value); } ?> </td> </tr> <?php } ?> </table> <?php if ($this->checker->test_moved()) { ?> <p><input type="submit" value="<?php esc_attr_e('Update Current Configuration', 'site-move-monitor'); ?> " class="button button-primary" /></p> <?php } else { ?> <p><input type="button" value="<?php esc_attr_e('Configuration is up-to-date', 'site-move-monitor'); ?> " class="button" disabled="disabled" /></p> <?php } ?> <?php wp_nonce_field('update', 'site_move_monitor_current_configuration'); ?> </form> </div> <?php }