Skip to content

Commit be7656a

Browse files
Add support for PHP variables in the DB queries
1 parent a1bc6f2 commit be7656a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

classes/Visualizer/Source/Query.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public function fetch( $as_html = false, $results_as_numeric_array = false, $raw
9090
$this->_query .= ' LIMIT ' . apply_filters( 'visualizer_sql_query_limit', 1000, $this->_chart_id );
9191
}
9292

93+
$this->_query = apply_filters( 'visualizer_db_query', $this->_query, $this->_chart_id, $this->_params );
94+
9395
$results = array();
9496
$headers = array();
9597

@@ -145,9 +147,12 @@ public function fetch( $as_html = false, $results_as_numeric_array = false, $raw
145147
}
146148

147149
if ( $as_html ) {
148-
return $this->html( $headers, $results );
150+
$results = $this->html( $headers, $results );
151+
} else {
152+
$results = $this->object( $headers, $results );
149153
}
150-
return $this->object( $headers, $results );
154+
155+
return apply_filters( 'visualizer_db_query_results', $results, $headers, $as_html, $results_as_numeric_array, $raw_results, $this->_query, $this->_chart_id, $this->_params );
151156
}
152157

153158
/**

0 commit comments

Comments
 (0)