本文整理汇总了PHP中vB::getDataStore方法的典型用法代码示例。如果您正苦于以下问题:PHP vB::getDataStore方法的具体用法?PHP vB::getDataStore怎么用?PHP vB::getDataStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB
的用法示例。
在下文中一共展示了vB::getDataStore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchPhrase
function fetchPhrase($params, $db, $check_only = false)
{
if ($check_only) {
return !empty($params['fieldname']) and !empty($params['phrasename']);
}
$params = vB::getCleaner()->cleanArray($params, array('fieldname' => vB_Cleaner::TYPE_STR, 'phrasename' => vB_Cleaner::TYPE_STR, 'alllanguages' => vB_Cleaner::TYPE_BOOL, 'languageid' => vB_Cleaner::TYPE_UINT));
//make sure we have a languageid
if (empty($params['languageid']) and !$params['alllanguages']) {
$session = vB::getCurrentSession();
if (empty($session)) {
$options = vB::getDataStore()->getValue('options');
$languageid = $options['languageid'];
} else {
$languageid = $session->get('languageid');
}
} else {
$languageid = $params['languageid'];
}
$sql = "\n\t\t\tSELECT text, languageid, special\n\t\t\tFROM " . TABLE_PREFIX . "phrase AS phrase\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "phrasetype USING (fieldname)\n\t\t\tWHERE phrase.fieldname = '" . $db->escape_string($params['fieldname']) . "'\n\t\t\tAND varname = '" . $db->escape_string($params['phrasename']) . "' " . iif(!$params['alllanguages'], "AND languageid IN (-1, 0, {$languageid})");
$resultclass = 'vB_dB_' . $this->db_type . '_result';
$config = vB::getConfig();
if (isset($config['Misc']['debug_sql']) and $config['Misc']['debug_sql']) {
echo "sql: {$sql}<br />\n";
}
$result = new $resultclass($db, $sql);
return $result;
}