本文整理汇总了PHP中wpdb::has_cap方法的典型用法代码示例。如果您正苦于以下问题:PHP wpdb::has_cap方法的具体用法?PHP wpdb::has_cap怎么用?PHP wpdb::has_cap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpdb
的用法示例。
在下文中一共展示了wpdb::has_cap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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();
}
示例2: SLPlus_Data
/**
* Initialize a new data object.
*
*/
public function SLPlus_Data($params = null)
{
global $wpdb;
$this->db = $wpdb;
// 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 '));
}
示例3: switch
function has_cap($db_cap)
{
switch ($this->dbType) {
case 'sqlite':
switch (strtolower($db_cap)) {
case 'collation':
// @since 2.5.0
// @since 2.5.0
case 'group_concat':
// @since 2.7
return false;
case 'subqueries':
// @since 2.7
return true;
break;
default:
return false;
}
break;
default:
return parent::has_cap($db_cap);
}
}