本文整理匯總了PHP中EE_Transaction::set_reg_steps方法的典型用法代碼示例。如果您正苦於以下問題:PHP EE_Transaction::set_reg_steps方法的具體用法?PHP EE_Transaction::set_reg_steps怎麽用?PHP EE_Transaction::set_reg_steps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::set_reg_steps方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: remove_reg_step
/**
* remove_reg_step
* given a valid TXN_reg_step slug, this will remove (unset)
* the reg step from the TXN reg step array
*
* @access public
* @param \EE_Transaction $transaction
* @param string $reg_step_slug
* @return void
*/
public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug)
{
// get reg steps array
$txn_reg_steps = $transaction->reg_steps();
unset($txn_reg_steps[$reg_step_slug]);
$transaction->set_reg_steps($txn_reg_steps);
}
示例2: _set_reg_step_completed_status
/**
* set_reg_step_completed
* given a valid reg step slug, this sets the TXN_reg_step completed status which is either:
*
*
* @access private
* @param \EE_Transaction $transaction
* @param string $reg_step_slug
* @param boolean | int $status
* @return boolean
*/
private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status)
{
// validate status
$status = is_bool($status) || is_numeric($status) ? $status : false;
// get reg steps array
$txn_reg_steps = $transaction->reg_steps();
// if reg step does NOT exist
if (!isset($txn_reg_steps[$reg_step_slug])) {
return false;
}
// if we're trying to complete a step that is already completed
if ($txn_reg_steps[$reg_step_slug] === true) {
return true;
}
// if we're trying to complete a step that hasn't even started
if ($status === true && $txn_reg_steps[$reg_step_slug] === false) {
return false;
}
// if current status value matches the incoming value (no change)
if ($txn_reg_steps[$reg_step_slug] === $status) {
// this will happen in cases where multiple AJAX requests occur during the same step
return true;
}
// if we're trying to set a start time
if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) {
// skip the update below, but don't return FALSE so that errors won't be displayed
return true;
}
// update completed status
$txn_reg_steps[$reg_step_slug] = $status;
$transaction->set_reg_steps($txn_reg_steps);
$transaction->save();
// DEBUG LOG
//$this->log(
// __CLASS__, __FUNCTION__, __LINE__,
// $transaction,
// array(
// 'reg_step_slug' => $reg_step_slug,
// 'status' => $status,
// )
//);
return true;
}