本文整理汇总了PHP中api_Utils::EncryptValue方法的典型用法代码示例。如果您正苦于以下问题:PHP api_Utils::EncryptValue方法的具体用法?PHP api_Utils::EncryptValue怎么用?PHP api_Utils::EncryptValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_Utils
的用法示例。
在下文中一共展示了api_Utils::EncryptValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareWhere
public function prepareWhere($aWhere, $oEntity, &$aWhereAttributes, $sOperator = 'AND')
{
$aResultOperations = array();
foreach ($aWhere as $sKey => $mValue) {
if (strpos($sKey, '$') !== false) {
list(, $sKey) = explode('$', $sKey);
$aResultOperations[] = $this->prepareWhere($mValue, $oEntity, $aWhereAttributes, $sKey);
} else {
$mResultValue = null;
$mResultOperator = '=';
if (is_array($mValue)) {
if (0 < count($mValue)) {
$mResultValue = $mValue[0];
$mResultOperator = $mValue[1];
}
} else {
$mResultValue = $mValue;
}
if (isset($mResultValue)) {
if (!in_array($sKey, $aWhereAttributes)) {
$aWhereAttributes[] = $sKey;
}
if ($oEntity->isEncryptedAttribute($sKey)) {
$mResultValue = \api_Utils::EncryptValue($mResultValue);
}
$bIsInOperator = false;
if (strtolower($mResultOperator) === 'in' || strtolower($mResultOperator) === 'not in' && is_array($mResultValue)) {
$bIsInOperator = true;
$mResultValue = array_map(function ($mValue) use($oEntity, $sKey) {
return $oEntity->isStringAttribute($sKey) ? $this->escapeString($mValue) : $mValue;
}, $mResultValue);
$mResultValue = '(' . implode(', ', $mResultValue) . ')';
}
$sValueFormat = $oEntity->isStringAttribute($sKey) ? "%s" : "%d";
$aResultOperations[] = sprintf("`attrs_%s`.`value` %s " . $sValueFormat, $sKey, $mResultOperator, $oEntity->isStringAttribute($sKey) && !$bIsInOperator ? $this->escapeString($mResultValue) : $mResultValue);
}
}
}
return sprintf(count($aResultOperations) > 1 ? '(%s)' : '%s', implode(' ' . $sOperator . ' ', $aResultOperations));
}
示例2: DbInsertArrays
/**
* @param object $oObject
* @param object $oHelper
* @return array
*/
public static function DbInsertArrays($oObject, $oHelper)
{
$aResult = array(false, false);
$sQueryParams = '';
$bUseLogQueryParams = (bool) CApi::GetConf('labs.db.log-query-params', false);
$oObject->initBeforeChange();
$aStaticMap = $oObject->getMap();
$aMap = api_AContainer::DbWriteKeys($aStaticMap, true);
$aDbKeys = array_keys($aMap);
$aResult[0] = array_map(array(&$oHelper, 'EscapeColumn'), $aDbKeys);
$aDbValues = array_values($aMap);
foreach ($aDbValues as $iIndex => $sKey) {
$mValue = $oObject->{$sKey};
if (isset($aStaticMap[$sKey][0])) {
if ('password' === $aStaticMap[$sKey][0]) {
$mValue = api_Utils::EncryptValue($mValue);
} else {
if ('datetime' === $aStaticMap[$sKey][0]) {
$mValue = $oHelper->TimeStampToDateFormat($mValue);
} else {
if ('serialize' === $aStaticMap[$sKey][0]) {
$mValue = '' === $mValue ? '' : serialize($mValue);
}
}
}
}
$aDbValues[$iIndex] = is_string($mValue) ? $oHelper->EscapeString($mValue) : (int) $mValue;
if ($bUseLogQueryParams) {
$sDbKey = isset($aDbKeys[$iIndex]) ? $aDbKeys[$iIndex] : '!unknown!';
$sQueryParams .= API_CRLF . API_TAB . $sDbKey . ' = ' . $aDbValues[$iIndex];
}
}
$aResult[1] = $aDbValues;
if ($bUseLogQueryParams) {
CApi::Log($sQueryParams);
}
return $aResult;
}
示例3: Encrypt
public function Encrypt()
{
$this->Value = \api_Utils::EncryptValue($this->Value);
}