Properties

$mainwp_db_version

$mainwp_db_version : string

Private variable to hold the database version info.

Type

string — DB version info.

$option_db_key

$option_db_key : string

Protected variable to hold the database option name.

Type

string — DB version info.

$table_prefix

$table_prefix : string

Table prefix.

Type

string

$wpdb

$wpdb : mixed

WordPress Database.

Type

mixed — WordPress Database.

$instance

$instance : mixed

Static variable to hold the single instance of the class.

Type

mixed — Default null

$cost_tracker_db_version

$cost_tracker_db_version : string

Variable to hold the db version.

Type

string — Version.

Methods

instance()

instance() : \MainWP\Dashboard\MainWP_DB

Method instance()

Return public static instance.

Returns

\MainWP\Dashboard\MainWP_DB

install()

install() : void

Install db.

Installs the new DB.

get_db_version()

get_db_version() : string

Returns the database version.

Returns

string

post_update()

post_update() : void

Method post_update()

Update MainWP DB.

pre_update_tables()

pre_update_tables() : void

Method pre_update_tables()

Handle pre update tables.

post_update_81()

post_update_81(string  $current_version) : void

Method post_update_81()

Update MainWP DB for version 8.1.

Parameters

string $current_version

Current version DB.

__construct()

__construct() 

MainWP_DB_Base constructor.

Run each time the class is called.

get_table_name()

get_table_name(mixed  $suffix) : string

Method get_table_name()

Create entire table name.

Parameters

mixed $suffix

Table suffix.

Returns

string —

Table name.

get_my_sql_version()

get_my_sql_version() : mixed

Method get_my_sql_version()

Get MySQL Version.

Returns

mixed —

MySQL vresion.

get_row_result()

get_row_result(mixed  $sql) : mixed

Method get_row_result()

Get row result.

Parameters

mixed $sql

SQL Query.

Returns

mixed —

null|Row

get_results_result()

get_results_result(mixed  $sql) : mixed

Method get_results_result()

Get Results of result.

Parameters

mixed $sql

SQL query.

Returns

mixed —

null|get_results()

query()

query(mixed  $sql) : mixed

Method query()

SQL Query.

Parameters

mixed $sql

SQL Query.

Returns

mixed —

false|$result.

escape()

escape(mixed  $data) : mixed

Method escape()

Escape SQL Data.

Parameters

mixed $data

Data to escape.

Returns

mixed —

Escapped SQL Data.

use_mysqli()

use_mysqli() : boolean|self

Method use_mysqli()

Use MySQLi, Support old & new versions of WordPress (3.9+).

Returns

boolean|self —

false|$instance Instance of \mysqli

ping()

ping(mixed  $link) : mixed

Method ping()

Ping MySQLi.

Parameters

mixed $link

Query link.

Returns

mixed —

\mysqli_ping

m_query()

m_query(mixed  $query, mixed  $link) : mixed

Method m_query()

MySQLi m_query.

Parameters

mixed $query

Query params.

mixed $link

Query link.

Returns

mixed —

\mysqli_query

fetch_object()

fetch_object(mixed  $result) : boolean|mixed

Method fetch_object()

Fetch object.

Parameters

mixed $result

Query result.

Returns

boolean|mixed —

false|\mysqli_fetch_object

free_result()

free_result(mixed  $result) : boolean|mixed

Method free_result()

MySQLi free result.

Parameters

mixed $result

Query result.

Returns

boolean|mixed —

false|\mysqli_free_result

data_seek()

data_seek(mixed  $result, mixed  $offset) : boolean|mixed

Method data_seek()

MySQLi data seek.

Parameters

mixed $result

Query result.

mixed $offset

Query offset.

Returns

boolean|mixed —

false|\mysqli_data_seek

fetch_array()

fetch_array(mixed  $result, null  $result_type = null) : boolean|mixed

Method fetch_array()

MySQLi fetch array.

Parameters

mixed $result

Query result.

null $result_type

Query result type.

Returns

boolean|mixed —

false|\mysqli_fetch_array.

num_rows()

num_rows(mixed  $result) : boolean|mixed

Method num_rows()

MySQLi number of rows.

Parameters

mixed $result

Query result.

Returns

boolean|mixed —

false|\mysqli_num_rows.

is_result()

is_result(mixed  $result) : boolean|mixed

Method is_result()

Return instance of \mysqli_result

Parameters

mixed $result

Query result.

Returns

boolean|mixed —

false|\mysqli_result

init()

init() 

Init functions.

update_cost_tracker()

update_cost_tracker(array  $update) : mixed

Method update_cost_tracker().

Parameters

array $update

Cost tracker array data.

Throws

\Exception

Existed cost tracker error.

Returns

mixed —

Result

get_cost_tracker_by()

get_cost_tracker_by(string  $by = 'id', mixed  $value = null, array  $params = array()) : mixed

Method get_cost_tracker_by().

Parameters

string $by

Get by.

mixed $value

Value.

array $params

Others params.

Returns

mixed —

Result

delete_cost_tracker()

delete_cost_tracker(string  $by = 'id', mixed  $value = null) : mixed

Method delete_cost_tracker().

Parameters

string $by

Delete by.

mixed $value

Value.

Returns

mixed —

Result

get_cost_tracker_info_of_clients()

get_cost_tracker_info_of_clients(array  $client_ids, array  $params = array()) : mixed

Method get_cost_tracker_info_of_clients().

Parameters

array $client_ids

Client ids.

array $params

Orther params.

Returns

mixed —

Result

get_cost_trackers_info_of_sites()

get_cost_trackers_info_of_sites(array  $sites_ids) : mixed

Method get_cost_trackers_info_of_sites().

Parameters

array $sites_ids

Sites ids.

Returns

mixed —

Result

test_connection()

test_connection() 

Method test_connection()

Test db connection.

table_name()

table_name(mixed  $suffix, null  $tablePrefix = null) : string

Method table_name()

Create entire table name.

Parameters

mixed $suffix

Table suffix.

null $tablePrefix

Table prefix.

Returns

string —

Table name.