本文整理汇总了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;
}