本文整理匯總了PHP中AlphaUserPointsHelper::operationIsFeasible方法的典型用法代碼示例。如果您正苦於以下問題:PHP AlphaUserPointsHelper::operationIsFeasible方法的具體用法?PHP AlphaUserPointsHelper::operationIsFeasible怎麽用?PHP AlphaUserPointsHelper::operationIsFeasible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AlphaUserPointsHelper
的用法示例。
在下文中一共展示了AlphaUserPointsHelper::operationIsFeasible方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: userpoints
public static function userpoints($plugin_function, $referrerid = '', $referraluserpoints = 0, $keyreference = '', $datareference = '', $randompoints = 0, $feedback = false, $force = 0, $frontmessage = '')
{
$lang = JFactory::getLanguage();
$lang->load('com_alphauserpoints', JPATH_SITE);
// get params definitions
$params = JComponentHelper::getParams('com_alphauserpoints');
$allowNegativeAccount = $params->get('allowNegativeAccount', 0);
$checkReference = 0;
if ($plugin_function == 'sysplgaup_recommend' && $referrerid != '' && $keyreference != '' && $datareference != '') {
$force = 1;
}
if (!$referraluserpoints) {
if (!$referrerid) {
$referrerid = @$_SESSION['referrerid'];
}
}
if (!$referrerid) {
return;
}
if (!AlphaUserPointsHelper::checkExcludeUsers($referrerid)) {
return;
}
$result = AlphaUserPointsHelper::checkRuleEnabled($plugin_function, $force, $referrerid);
// check reference if not exist
if ($keyreference != '' && $result) {
$checkReference = AlphaUserPointsHelper::checkReference($referrerid, $keyreference, $result[0]->id);
}
if ($result && !$checkReference) {
// force specific points -> overwriting rule points or if rule points is 0
// This points can be negative (example : single rule in backend rule manager for several products on frontend, each products with different prices...)
if ($randompoints) {
$result[0]->points = $randompoints;
}
// check if limit daily points
if ($result[0]->points > 0 && $referraluserpoints == 0) {
$result[0]->points = AlphaUserPointsHelper::checkMaxDailyPoints($referrerid, $result[0]->points, $plugin_function);
}
if (AlphaUserPointsHelper::operationIsFeasible($referrerid, $result[0]->points) || $allowNegativeAccount) {
// check account
AlphaUserPointsHelper::insertUserPoints($referrerid, $result[0], $referraluserpoints, $keyreference, $datareference, $frontmessage);
if ($feedback == true) {
return true;
}
} else {
// used for negative operation,
$error = JText::_('AUP_YOUDONOTHAVEENOUGHPOINTSTOPERFORMTHISOPERATION');
JError::raiseNotice(0, $error);
if ($feedback == true) {
return false;
} else {
return;
}
}
} else {
return true;
}
}