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;

		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.36.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.