本文整理汇总了PHP中ipsRegistry::fetchBitWiseOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP ipsRegistry::fetchBitWiseOptions方法的具体用法?PHP ipsRegistry::fetchBitWiseOptions怎么用?PHP ipsRegistry::fetchBitWiseOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipsRegistry
的用法示例。
在下文中一共展示了ipsRegistry::fetchBitWiseOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Save member
*
* @access public
* @param int Member key: Either Array, ID or email address. If it's an array, it must be in the format:
* array( 'core' => array( 'field' => 'member_id', 'value' => 1 ) ) - useful for passing custom fields through
* @param array Fields to save in the following format: array( 'members' => array( 'email' => 'test@test.com',
* 'joined' => time() ),
* 'extendedProfile' => array( 'signature' => 'My signature' ) );
* Tables: members, pfields_content, profile_portal.
* You can also use the aliases: 'core [members]', 'extendedProfile [profile_portal]', and 'customFields [pfields_content]'
* @return boolean True if the save was successful
*
* Exception Error Codes:
* NO_DATA : No data to save
* NO_VALID_KEY : No valid key to save
* NO_AUTO_LOAD : Could not autoload the member as she does not exist
* INCORRECT_TABLE : Table one is attempting to save to does not exist
* NO_MEMBER_GROUP_ID: Member group ID is in the array but blank
*/
public static function save($member_key, $save = array())
{
$member_id = 0;
$member_email = '';
$member_field = '';
$_updated = 0;
$bitWiseFields = ipsRegistry::fetchBitWiseOptions('global');
$member_k_array = array('members' => array(), 'pfields_content' => array(), 'profile_portal' => array());
$_tables = array_keys($save);
$_MEMBERKEY = 'member_id';
$_MEMBERVALUE = $member_key;
//-----------------------------------------
// Test...
//-----------------------------------------
if (!is_array($save) or !count($save)) {
throw new Exception('NO_DATA');
}
//-----------------------------------------
// ID or email?
//-----------------------------------------
if (!is_array($member_key)) {
if (strstr($member_key, '@')) {
$_MEMBERKEY = 'email';
$member_k_array['members'] = array('field' => 'email', 'value' => "'" . ipsRegistry::instance()->DB()->addSlashes(strtolower($member_key)) . "'");
//-----------------------------------------
// Check to see if we've got more than the core
// table to save on.
//-----------------------------------------
$_got_more_than_core = FALSE;
foreach ($_tables as $table) {
if (isset(self::$remap[$table])) {
$table = self::$remap[$table];
}
if ($table != 'members') {
$_got_more_than_core = TRUE;
break;
}
}
if ($_got_more_than_core === TRUE) {
/* Get the ID */
$_memberTmp = self::load($member_key, 'core');
if ($_memberTmp['member_id']) {
$member_k_array['pfields_content'] = array('field' => 'member_id', 'value' => $_memberTmp['member_id']);
$member_k_array['profile_portal'] = array('field' => 'pp_member_id', 'value' => $_memberTmp['member_id']);
} else {
throw new Exception("NO_AUTO_LOAD");
}
}
} else {
$member_k_array['members'] = array('field' => 'member_id', 'value' => intval($member_key));
$member_k_array['pfields_content'] = array('field' => 'member_id', 'value' => intval($member_key));
$member_k_array['profile_portal'] = array('field' => 'pp_member_id', 'value' => intval($member_key));
self::_updateCache($member_key, $save);
}
} else {
$_member_k_array = $member_k_array;
foreach ($member_key as $table => $data) {
if (isset(self::$remap[$table])) {
$table = self::$remap[$table];
}
if (!in_array($table, array_keys($_member_k_array))) {
throw new Exception('INCORRECT_TABLE');
}
$member_k_array[$table] = $data;
}
}
//-----------------------------------------
// Test...
//-----------------------------------------
if (!is_array($member_k_array) or !count($member_k_array)) {
throw new Exception('NO_DATA');
}
//-----------------------------------------
// Now save...
//-----------------------------------------
foreach ($save as $table => $data) {
if (isset(self::$remap[$table])) {
$table = self::$remap[$table];
}
if ($table == 'profile_portal') {
//.........这里部分代码省略.........
示例2: _getBitWiseArray
/**
* Fetch and build the bitwise array
*
* @param string Array key to return
* @return array
*/
protected static function _getBitWiseArray($type, $app)
{
$bitArray = array();
$allOptions = ipsRegistry::fetchBitWiseOptions($app);
if (is_array($allOptions)) {
if (isset($allOptions[$type]) and is_array($allOptions[$type])) {
$n = 1;
foreach ($allOptions[$type] as $key) {
$bitArray[$key] = $n;
$n *= 2;
}
}
}
return $bitArray;
}