"0", "txtar_log" => ""); update_option('wpgo_admin_log_options', $arr); } } // Delete options table entries only when plugin deactivated AND deleted public static function delete_plugin_options() { delete_option('wpgo_admin_log_options'); delete_option('wpgo_admin_log'); } // Use the Settings API for our Plugin options public function admin_init(){ register_setting( 'wpgo_admin_log_plugin_options', 'wpgo_admin_log_options' ); } // Add menu page public function add_options_page() { add_options_page('Admin Log Options Page', 'Admin Log', 'manage_options', __FILE__, array( $this, 'render_form' ) ); } // Draw the menu page itself public function render_form() { ?>
= 200 ) $log = $this->remove_first_line($log); // Is user logged in? if ($user) { $uri = basename($_SERVER["REQUEST_URI"]); if ( !( isset($options['chk_ignore_adminlog']) && $options['chk_ignore_adminlog']=="1" && ( $uri=="admin-log.php" || $uri=="options-general.php?page=admin-log%2Fadmin-log.php&settings-updated=true" ) ) ) { $url = explode("/wp-admin/", $_SERVER["REQUEST_URI"]); $date = date_i18n('j/n/y@G:i:s'); $txt = $date.' '.$user->display_name.'('.$user->ID.') => ['.$_SERVER['REMOTE_ADDR'].'] '.$url[1]."\r\n"; $txt = $log.$txt; update_option('wpgo_admin_log', $txt); } } } } public function remove_first_line($txt) { return substr( $txt, strpos($txt, "\r\n")+1 ); } // Get URL of current page public function currURL() { $pageURL = 'http'; if( isset($_SERVER["HTTPS"]) ) { if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} } $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } public function save_error(){ update_option( 'wpgo_admin_log_plugin_error', ob_get_contents() ); } } /* Create Plugin class instance */ $wpgo_admin_log_plugin = new WPGo_Admin_Log_Plugin();