Skip to content

Commit

Permalink
Added global use of wbdb
Browse files Browse the repository at this point in the history
  • Loading branch information
allyshka committed Apr 14, 2015
1 parent 03780b0 commit b80e1c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions wp-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* License: GPLv2 or later
* Text Domain: wp-logger
*/
include_once($_SERVER['DOCUMENT_ROOT'].'/wp-config.php' );
include_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php' );

class WP_Logger extends wpdb {
Expand Down Expand Up @@ -43,6 +42,7 @@ class WP_Logger extends wpdb {
* Adds all of the filters and hooks and enforces singleton pattern
*/
function __construct() {
global $wbdb;

// Enforces a single instance of this class.
if ( isset( self::$instance ) ) {
Expand Down Expand Up @@ -81,7 +81,7 @@ function __construct() {
// Show log file if needed
if(!empty($_GET['show']) && !empty($_GET['log'])) {
$this->file = $_GET['log'];
print $this->showLogFile();
print $this->showLogFile($this->file);
}
}

Expand Down Expand Up @@ -337,7 +337,7 @@ function add_menu_page() {
* @return array Containing the comment query arguments.
*/
function add_comment_author( $pieces, &$comment ) {
//global $wpdb;
global $wpdb;

if ( isset( $comment->query_vars['comment_author'] ) ) {
$pieces['where'] .= $this->prepare( ' AND comment_author = %s', $comment->query_vars['comment_author'] );
Expand Down Expand Up @@ -929,7 +929,7 @@ private function get_logs( $plugin_term, $purge = false ) {
/**
* Retrive log file to show
*/
private function showLogFile() {
private function showLogFile($file) {
return file_get_contents(dirname(__FILE__).'/logs/'.basename($this->$file));
}

Expand Down

0 comments on commit b80e1c3

Please sign in to comment.