public function has_cap($db_cap)
{
$version = $this->db_version();
switch (strtolower($db_cap)) {
case 'collation':
// @since 2.5.0
// @since 2.5.0
case 'group_concat':
// @since 2.7.0
// @since 2.7.0
case 'subqueries':
// @since 2.7.0
return version_compare($version, '4.1', '>=');
case 'set_charset':
return version_compare($version, '5.0.7', '>=');
}
return false;
}
/** * Initialize a new data object. */ public function __construct($params = null) { global $wpdb; $this->db = $wpdb; // Set parameters. // if ($params != null && is_array($params)) { foreach ($params as $key => $value) { $this->{$key} = $value; } } // Collation // $collate = ''; if ($this->db->has_cap('collation')) { if (!empty($this->db->charset)) { $collate .= "DEFAULT CHARACTER SET {$this->db->charset}"; } if (!empty($this->db->collate)) { $collate .= " COLLATE {$this->db->collate}"; } } $this->collate = $collate; // Legacy stuff - replace with data property below. // $this->info = array('table' => $this->db->prefix . 'store_locator', 'query' => array('selectthis' => 'SELECT %s FROM ' . $this->db->prefix . 'store_locator ')); $this->add_filters(); $this->set_properties(); }