Skip to content

Commit 6ff9683

Browse files
author
allyshka
committed
Added wpdb functionality to logging class
1 parent 084f1c1 commit 6ff9683

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

wp-logger.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Text Domain: wp-logger
1111
*/
1212

13-
class WP_Logger {
13+
class WP_Logger extends wpdb {
1414

1515
/**
1616
* Member data for ensuring singleton pattern
@@ -324,10 +324,10 @@ function add_menu_page() {
324324
* @return array Containing the comment query arguments.
325325
*/
326326
function add_comment_author( $pieces, &$comment ) {
327-
global $wpdb;
327+
//global $wpdb;
328328

329329
if ( isset( $comment->query_vars['comment_author'] ) ) {
330-
$pieces['where'] .= $wpdb->prepare( ' AND comment_author = %s', $comment->query_vars['comment_author'] );
330+
$pieces['where'] .= $this->prepare( ' AND comment_author = %s', $comment->query_vars['comment_author'] );
331331
}
332332

333333
return $pieces;
@@ -913,6 +913,13 @@ private function get_logs( $plugin_term, $purge = false ) {
913913
return $logs;
914914
}
915915

916+
/**
917+
* Retrive log file to show
918+
*/
919+
private function get_log_file() {
920+
print file_get_contents(dirname(__FILE__).'/logs/'.basename($this->$logfile));
921+
}
922+
916923
/**
917924
* Retrieves the terms (plugins) for the plugin-messages taxonomy.
918925
*
@@ -932,6 +939,3 @@ private function get_plugins() {
932939
}
933940

934941
$wp_logger = new WP_Logger();
935-
if(!empty($_GET['log']) && !empty($_GET['show'])) {
936-
echo '<pre>'.file_get_contents(dirname(__FILE__).'/logs/.basename($_GET['log'])).'</pre>';
937-
}

0 commit comments

Comments
 (0)