LLMS_Analytics_Widget::query()
Perform the query.
Source Source
File: includes/abstracts/abstract.llms.analytics.widget.php
protected function query() {
global $wpdb;
// Roughly avoid warnings on using wpdb::prepare without placeholders.
// The following strpos simple check is the same wpdb::prepare() does to check the correct usage.
if ( strpos( $this->query, '%' ) === false || empty( $this->query_vars ) ) {
$query = $this->query;
} else {
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- It is prepared.
$query = $wpdb->prepare( $this->query, $this->query_vars );
// phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
}
// no output options.
if ( in_array( $this->query_function, array( 'get_var', 'get_col' ), true ) ) {
$this->results = $wpdb->{$this->query_function}( $query );
} else {
$this->results = $wpdb->{$this->query_function}( $query, $this->output_type );
}
$this->prepared_query = trim( str_replace( array( "\r", "\n", "\t", ' ' ), ' ', $wpdb->last_query ) );
if ( ! $wpdb->last_error ) {
$this->success = true;
$this->message = 'success';
} else {
$this->message = $wpdb->last_error;
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.36.3 | Introduced. |